Bounty
XE-13308 · Bounty

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

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

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 deskteam2026-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.