XE-13316 · Bounty
[net/gossip.go] H15: broadcast() tidak handle peer yang tidak reachable — resource leak
Report
Ringkasan
Kalau peer tidak reachable, broadcast tetap dikirim. Kalau error terjadi berulang, resource bisa menumpuk.
Lokasi
- File:
net/gossip.go - Lines: 171-187
Kode
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
...
for pid := range g.peers {
if pid == g.host.ID() {
continue
}
go g.sendToPeer(pid, key, msg)
}
}
Impact
Resource leak kalau peer tidak reachable. Bisa menyebabkan resource exhaustion.
Suggested Fix
func (g *Gossip) broadcast(key string, msg []byte, mode GossipMode) {
...
for pid := range g.peers {
if pid == g.host.ID() {
continue
}
go g.sendToPeerWithRetry(pid, key, msg)
}
}
func (g *Gossip) sendToPeerWithRetry(pid peer.ID, key string, msg []byte) {
var lastErr error
for i := 0; i < 3; i++ {
if err := g.sendToPeer(pid, key, msg); err != nil {
lastErr = err
logging.Warnf("gossip: failed to send message to %s (attempt %d): %v", pid, i+1, err)
time.Sleep(time.Second * time.Duration(i+1))
continue
}
return
}
logging.Warnf("gossip: failed to send message to %s after 3 attempts: %v", pid, lastErr)
}
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-13316 and says what; it is read like any other.