XE-13305 · Bounty
[net/gossip.go] H4: gossipHandler() tidak handle concurrent message processing — race condition
Report
Ringkasan
gossipHandler dipanggil dari stream handler tanpa mutex protection. Kalau multiple stream datang bersamaan, handler dijalankan secara concurrent. Tidak ada issue yang ditemukan, tapi worth noting.
Lokasi
- File:
net/gossip.go - Lines: 219-245
Kode
func (g *Gossip) gossipHandler(stream network.Stream) {
...
var msg GossipMessage
if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
logging.Debugf("gossip: failed to decode message: %v", err)
return
}
// handler dijalankan tanpa mutex protection
g.handleMessage(msg)
}
Impact
Kalau multiple stream datang bersamaan, handler dijalankan secara concurrent. Meskipun saat ini tidak ada issue yang ditemukan, handler harus thread-safe.
Suggested Fix
func (g *Gossip) gossipHandler(stream network.Stream) {
...
var msg GossipMessage
if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
logging.Debugf("gossip: failed to decode message: %v", err)
return
}
// gunakan goroutine per message dan jangan pakai shared state tanpa synchronization
go g.handleMessage(msg)
}
Atau tambah mutex protection:
func (g *Gossip) gossipHandler(stream network.Stream) {
...
var msg GossipMessage
if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
logging.Debugf("gossip: failed to decode message: %v", err)
return
}
g.mu.Lock()
g.handleMessage(msg)
g.mu.Unlock()
}
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-13305 and says what; it is read like any other.