XE-13312 · Bounty
[net/gossip.go] H11: peerPing() tidak handle timeout — goroutine leak
Report
Ringkasan
Kalau peer tidak merespon dalam waktu yang ditentukan, goroutine tetap berjalan. Tidak ada timeout mechanism.
Lokasi
- File:
net/gossip.go - Lines: 281-300
Kode
func (g *Gossip) peerPing(pid peer.ID) {
...
stream, err := g.host.NewStream(g.ctx, pid, GossipProtocolID)
if err != nil {
logging.Debugf("gossip: failed to open stream to %s: %v", pid, err)
return
}
defer stream.Close()
...
}
Impact
Goroutine leak kalau peer tidak merespon. Resource exhaustion.
Suggested Fix
func (g *Gossip) peerPing(ctx context.Context, pid peer.ID) {
...
stream, err := g.host.NewStream(ctx, pid, GossipProtocolID)
if err != nil {
logging.Debugf("gossip: failed to open stream to %s: %v", pid, err)
return
}
defer stream.Close()
// tambah timeout
select {
case <-ctx.Done():
return
case <-time.After(5 * time.Second):
return
}
}
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-13312 and says what; it is read like any other.