XE-13225 · Bounty
node: uncoordinated n.wg.Add(1) and callback goroutines race with Stop() WaitGroup.Wait/store.Close and conflict/phantom pulls bypass pullSem
Report
Summary
node.Node mixes untracked background sweepers and store-touching callbacks with unguarded dynamic n.wg.Add(1) calls across asynchronous paths, while leaving conflict block/vote pull goroutines outside n.pullSem:
-
Concurrent
WaitGroup.AddvsWaitpanic and post-Closestore access duringStop():node.New(node/node.go:275-292) launchesquorumMgr.StartStaleConflictSweep(ctx.Done())and the 15svoteMgr.SweepFrontiers()ticker outsiden.wg, wiresledger.SetConflictCallback(voteMgr.OnConflict)andledger.SetBlockAddedCallback(voteMgr.OnBlockAdded)(node/node.go:278-279, invoked viago cb(...)insidecore/ledger.go) plusxenet.SetupCertSync(..., n.ingestCertificate)(node/node.go:581) withoutn.wgtracking, and mutatesn.QuorumMgr.PhantomPullFnandn.QuorumMgr.VotePullFn~300 lines after starting the sweepers (node/node.go:584, 587) without synchronization.Node.Stop()(node/node.go:1301-1309) cancelsn.ctx, callsn.wg.Wait(), and closesn.store. Meanwhile, untracked sweepers/callbacks,go qm.OnFinalized()(core/quorum.go:408-410->voteMgr.SweepFrontiers->pullFrontierVotes),sc.SetOnBlock(node/node.go:506),handleIncoming(node/node.go:722), andleaseWatchTick(node/node.go:1692) can invoken.wg.Add(1)concurrently withn.wg.Wait()(triggering Go'ssync: WaitGroup misuse: Add called concurrently with Waitpanic) or continue reading/writingn.storeaftern.store.Close().
-
Unbounded conflict/phantom pull goroutines and missing post-pull
Retally:pullFrontierVotes(node/node.go:926-949) bounds concurrency vian.pullSem(maxInFlightVotePulls = 32), whereaspullPhantomBlocks(node/node.go:887-907) andpullConflictVotes(node/node.go:909-924) spawn a new goroutine on every call without acquiringn.pullSem. Each 15s stale-conflict sweep (core/quorum.go:523-589) iteratesGetAllConflicts()and can spawn unbounded concurrent P2P stream goroutines across open conflicts.- When
pullPhantomBlocksretrieves missing candidate bodies after quorum votes have already been recorded,Ledger.AddBlockstages the candidate body inConflictStorewithout re-runningQuorumMgr.Retally(account, previous), leaving resolvable conflicts stalled until the next external vote event.
Locations (origin/master @ 89a542ea)
node/node.go:275-292, 506, 551-640, 672, 722, 887-949, 1301-1309, 1692core/quorum.go:408-428, 523-589
Reproduction / Impact
- Calling
Node.Stop()whileQuorumMgrcallbacks (PhantomPullFn,VotePullFn,OnFinalized),Ledgerconflict/block callbacks, orleaseWatchTickfire concurrently triggerssync.WaitGroupmisuse panics or accessesn.storeaftern.store.Close(). - Calling
pullPhantomBlocksandpullConflictVotesacross >32 open conflicts spawns unbounded P2P stream goroutines instead of respectingmaxInFlightVotePulls = 32.
Thread
Joseph Denneteam2026-11-20 00:05 UTCgithub
Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-13225 and says what differs; it is read like any other.