Bounty
XE-13300 · Bounty

[net/sync.go] M14: peerSyncWorker tidak pakai backoff — sync gagal berulang

Closed · invalid — xe#445 filed 2026-11-12 02:53 UTC by wahyu20260100233-ops

Report

Ringkasan

Kalau sync gagal, worker langsung retry tanpa jeda. Bisa menyebabkan sync storm (banyak sync attempt sekaligus).

Lokasi

  • File: net/sync.go
  • Lines: 383-404

Kode

func (t *tracker) peerSyncWorker(ctx context.Context, h host.Host, pid peer.ID) {
    ...
    for {
        select {
        case <-ctx.Done():
            return
        case <-t.syncCh[pid]:
            if err := t.SyncTo(ctx, h, pid); err != nil {
                logging.Warnf("sync: failed to sync with %s: %v", pid, err)
            }
        }
    }
}

Impact

Sync gagal berulang tanpa jeda. Network congestion, waste resource.

Suggested Fix

func (t *tracker) peerSyncWorker(ctx context.Context, h host.Host, pid peer.ID) {
    ...
    backoff := time.Second
    for {
        select {
        case <-ctx.Done():
            return
        case <-t.syncCh[pid]:
            if err := t.SyncTo(ctx, h, pid); err != nil {
                logging.Warnf("sync: failed to sync with %s: %v", pid, err)
                time.Sleep(backoff)
                backoff *= 2
                if backoff > 30*time.Second {
                    backoff = 30 * time.Second
                }
            } else {
                backoff = time.Second
            }
        }
    }
}

Thread

XE deskteam2026-11-20 00:49 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links https://bounty.xe.network/XE-13300 and says what; it is read like any other.