<!-- XE-13307 · [net/gossip.go] H6: gossipHandler() tidak handle context cancellation — goroutine leak · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13307>. The page is the record; this is the same page for reading.*

XE-13307 · Bounty

# \[net/gossip.go\] H6: gossipHandler() tidak handle context cancellation — goroutine leak

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

- [559443](https://bounty.xe.network/log/559443) 2026-11-20 00:50 UTC reply.mirrored
- [558507](https://bounty.xe.network/log/558507) 2026-11-20 00:49 UTC reply.sent
- [554112](https://bounty.xe.network/log/554112) 2026-11-20 00:36 UTC github.state\_pushed
- [554110](https://bounty.xe.network/log/554110) 2026-11-20 00:36 UTC github.labels
- [553376](https://bounty.xe.network/log/553376) 2026-11-20 00:33 UTC proposal.adopted
- [553208](https://bounty.xe.network/log/553208) 2026-11-20 00:33 UTC proposal.adopted
- [553207](https://bounty.xe.network/log/553207) 2026-11-20 00:33 UTC ticket.status new → closed
- [552885](https://bounty.xe.network/log/552885) 2026-11-20 00:33 UTC proposal.adopted
- [552884](https://bounty.xe.network/log/552884) 2026-11-20 00:33 UTC ticket.facts area
- [552883](https://bounty.xe.network/log/552883) 2026-11-20 00:33 UTC proposal.adopted
- [552882](https://bounty.xe.network/log/552882) 2026-11-20 00:33 UTC ticket.facts
- [550363](https://bounty.xe.network/log/550363) 2026-11-20 00:28 UTC note.added

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

### Report

## Ringkasan

Kalau context cancelled, stream handler tidak di-stop. Goroutine yang di-spawn untuk handle message tetap berjalan.

## 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
    }
    g.handleMessage(msg)
}
```

## Impact

Goroutine leak kalau context cancelled. Resource exhaustion.

## Suggested Fix

```
func (g *Gossip) gossipHandler(stream network.Stream) {
    ...
    ctx := stream.Conn().Context()
    var msg GossipMessage
    if err := gob.NewDecoder(stream).Decode(&msg); err != nil {
        logging.Debugf("gossip: failed to decode message: %v", err)
        return
    }

    select {
    case <-ctx.Done():
        return
    default:
        g.handleMessage(msg)
    }
}
```

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