<!-- XE-13297 · [net/sync.go] M11: syncPeer() tidak handle error dari dialStreams — goroutine leak · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13297>. The page is the record; this is the same page for reading.*

XE-13297 · Bounty

# \[net/sync.go\] M11: syncPeer() tidak handle error dari dialStreams — goroutine leak

Closed · invalid
—
[xe#442](https://github.com/xeprotocol/xe/issues/442)
filed 2026-11-12 02:52 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:49 UTC

### Patches

None linked.

### History

- [557457](https://bounty.xe.network/log/557457) 2026-11-20 00:49 UTC reply.mirrored
- [557083](https://bounty.xe.network/log/557083) 2026-11-20 00:48 UTC reply.sent
- [554076](https://bounty.xe.network/log/554076) 2026-11-20 00:35 UTC github.state\_pushed
- [554075](https://bounty.xe.network/log/554075) 2026-11-20 00:35 UTC github.labels
- [553355](https://bounty.xe.network/log/553355) 2026-11-20 00:33 UTC proposal.adopted
- [553161](https://bounty.xe.network/log/553161) 2026-11-20 00:33 UTC proposal.adopted
- [553160](https://bounty.xe.network/log/553160) 2026-11-20 00:33 UTC ticket.status new → closed
- [552751](https://bounty.xe.network/log/552751) 2026-11-20 00:33 UTC proposal.adopted
- [552750](https://bounty.xe.network/log/552750) 2026-11-20 00:33 UTC ticket.facts area
- [552745](https://bounty.xe.network/log/552745) 2026-11-20 00:33 UTC proposal.adopted
- [552744](https://bounty.xe.network/log/552744) 2026-11-20 00:33 UTC ticket.facts
- [550845](https://bounty.xe.network/log/550845) 2026-11-20 00:31 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13297) · [JSON](https://bounty.xe.network/v1/tickets/XE-13297) · [markdown](https://bounty.xe.network/XE-13297.md)

### Report

## Ringkasan

Kalau `dialStreams` gagal, error hanya di-log. Tidak ada cleanup. Kalau error terjadi berulang, goroutine yang di-spawn bisa menumpuk.

## Lokasi

- File: `net/sync.go`
- Lines: 248-274

## Kode

```
func (t *tracker) syncPeer(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
    ...
    if err := t.dialStreams(ctx, h, pid, opts...); err != nil {
        logging.Warnf("sync: failed to dial streams to %s: %v", pid, err)
        return err
    }
    ...
}
```

## Impact

Goroutine leak kalau dialStreams gagal berulang. Resource exhaustion.

## Suggested Fix

```
func (t *tracker) syncPeer(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
    ...
    if err := t.dialStreams(ctx, h, pid, opts...); err != nil {
        logging.Warnf("sync: failed to dial streams to %s: %v", pid, err)
        t.mu.Lock()
        t.syncIncapable[pid] = struct{}{}
        t.mu.Unlock()
        return err
    }
    ...
}
```

Atau tambah retry dengan backoff:

```
func (t *tracker) syncPeer(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
    ...
    var lastErr error
    for i := 0; i < 3; i++ {
        if err := t.dialStreams(ctx, h, pid, opts...); err != nil {
            lastErr = err
            logging.Warnf("sync: failed to dial streams to %s (attempt %d): %v", pid, i+1, err)
            time.Sleep(time.Second * time.Duration(i+1))
            continue
        }
        return nil
    }
    return lastErr
}
```

### Thread

**XE desk**team2026-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-13297 and says what; it is read like any other.
