<!-- XE-13305 · [net/gossip.go] H4: gossipHandler() tidak handle concurrent message processing — race condition · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13305>. The page is the record; this is the same page for reading.*

XE-13305 · Bounty

# \[net/gossip.go\] H4: gossipHandler() tidak handle concurrent message processing — race condition

Closed · invalid
—
[xe#450](https://github.com/xeprotocol/xe/issues/450)
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

- [559445](https://bounty.xe.network/log/559445) 2026-11-20 00:50 UTC reply.mirrored
- [558513](https://bounty.xe.network/log/558513) 2026-11-20 00:49 UTC reply.sent
- [554060](https://bounty.xe.network/log/554060) 2026-11-20 00:35 UTC github.state\_pushed
- [554059](https://bounty.xe.network/log/554059) 2026-11-20 00:35 UTC github.labels
- [553378](https://bounty.xe.network/log/553378) 2026-11-20 00:33 UTC proposal.adopted
- [553213](https://bounty.xe.network/log/553213) 2026-11-20 00:33 UTC proposal.adopted
- [553212](https://bounty.xe.network/log/553212) 2026-11-20 00:33 UTC ticket.status new → closed
- [552894](https://bounty.xe.network/log/552894) 2026-11-20 00:33 UTC proposal.adopted
- [552893](https://bounty.xe.network/log/552893) 2026-11-20 00:33 UTC ticket.facts area
- [552892](https://bounty.xe.network/log/552892) 2026-11-20 00:33 UTC proposal.adopted
- [552891](https://bounty.xe.network/log/552891) 2026-11-20 00:33 UTC ticket.facts
- [550352](https://bounty.xe.network/log/550352) 2026-11-20 00:28 UTC note.added

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

### 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 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-13305 and says what; it is read like any other.
