<!-- XE-13308 · [net/gossip.go] H7: broadcast() tidak handle context cancellation — goroutine leak · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13308>. The page is the record; this is the same page for reading.*

XE-13308 · Bounty

# \[net/gossip.go\] H7: broadcast() tidak handle context cancellation — goroutine leak

Closed · invalid
—
[xe#453](https://github.com/xeprotocol/xe/issues/453)
filed 2026-11-12 02:54 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:50 UTC

### Patches

None linked.

### History

- [559442](https://bounty.xe.network/log/559442) 2026-11-20 00:50 UTC reply.mirrored
- [558505](https://bounty.xe.network/log/558505) 2026-11-20 00:49 UTC reply.sent
- [554857](https://bounty.xe.network/log/554857) 2026-11-20 00:37 UTC github.state\_pushed
- [554848](https://bounty.xe.network/log/554848) 2026-11-20 00:37 UTC github.labels
- [553375](https://bounty.xe.network/log/553375) 2026-11-20 00:33 UTC proposal.adopted
- [553206](https://bounty.xe.network/log/553206) 2026-11-20 00:33 UTC proposal.adopted
- [553205](https://bounty.xe.network/log/553205) 2026-11-20 00:33 UTC ticket.status new → closed
- [552881](https://bounty.xe.network/log/552881) 2026-11-20 00:33 UTC proposal.adopted
- [552880](https://bounty.xe.network/log/552880) 2026-11-20 00:33 UTC ticket.facts area
- [552879](https://bounty.xe.network/log/552879) 2026-11-20 00:33 UTC proposal.adopted
- [552878](https://bounty.xe.network/log/552878) 2026-11-20 00:33 UTC ticket.facts
- [550369](https://bounty.xe.network/log/550369) 2026-11-20 00:28 UTC note.added

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

### Report

## Ringkasan

Kalau context cancelled, broadcast goroutine tetap berjalan sampai selesai. Tidak ada cleanup mechanism.

## Lokasi

- File: `net/gossip.go`
- Lines: 171-187

## Kode

```
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
    ...
    for _, pid := range peers {
        go g.sendToPeer(pid, key, msg)
    }
}
```

## Impact

Goroutine leak kalau context cancelled. Resource exhaustion.

## Suggested Fix

```
func (g *Gossip) broadcast(ctx context.Context, key string, msg []byte, mode GossipMode) {
    ...
    for _, pid := range peers {
        go func(pid peer.ID) {
            select {
            case <-ctx.Done():
                return
            default:
                g.sendToPeer(pid, key, msg)
            }
        }(pid)
    }
}
```

### Thread

**XE desk**team2026-11-20 00:50 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-13308 and says what; it is read like any other.
