Node.Stop() stalls ~65–70 s on an in-flight performance-certificate benchmark
Report
Severity: Minor (XE tier ceiling 650 XE). CVSS 3.1: 4.0 (AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L) — CVSS Medium at the boundary; XE tier Minor per the bounty tier table (see §7).
Target: github.com/xeprotocol/xe @ 89a542ea51d38375299aee54c6c99102e9bfa666 ("release: testnet-0005 quorum withhold fix", 2026-11-10). Go 1.25.0.
1. Impact (read this first)
Node.Stop() waits out a running performance-certificate benchmark whenever a certificate attempt is in flight: an operator who stops the node during a cert attempt waits ~65–70 s with no response (no timeout, no interrupt). Measured at HEAD: benchmark wall 68.17 s, Stop latency 70.20 s — Stop issued 1 s into a live maintainCertificate attempt waited out the in-flight benchmark.
The stall is bounded: after a failed attempt the loop re-checks ctx and returns, so Stop() waits at most ONE attempt (~64–68 s), not the whole retry chain. The benchmark runs at node start (no cert yet) and at each renewal (certRenewalDelay), so the window recurs on every cert cycle, not just once. No remote trigger, no crash, no leak, no state corruption, no funds: a bounded shutdown delay. That is why this is Minor.
2. Root cause
A ~64–68 s CPU-bound, non-cancellable unit of work sits inside a wg-tracked goroutine whose only ctx checks are between attempts. generatePerformanceCertificate (node/perf.go:34) calls perf.RunBenchmark(seed, perf.PoWPuzzles) (node/perf.go:58; perf/benchmark.go:114-130, PoWPuzzles = 1024 (perf/benchmark.go:15), 19-bit puzzles (PoWDifficultyBits = 19, :17), solvePuzzle workers with no ctx). It is called from certGenerationLoop (node/perf.go:201, ctx checked only BETWEEN attempts) inside maintainCertificate (node/perf.go:158), spawned as a wg-tracked goroutine at node/node.go:557. Stop() (node/node.go:1301-1308) wg.Wait()s it with no timeout. Neither the benchmark nor the cert loop checks ctx mid-attempt, so there is nothing for Stop() to interrupt — it waits for the puzzles to finish.
3. Scenario (how it happens)
- A node starts (no certificate yet) or reaches a certificate renewal:
maintainCertificatebegins ageneratePerformanceCertificateattempt — 1024 sequential 19-bit puzzles, ~64–68 s of CPU work. - The operator stops the node (
Node.Stop(), e.g. SIGTERM during an upgrade or restart) while the attempt is in flight. Stop()callsn.cancel()and thenn.wg.Wait()— and waits. The benchmark does not observe the cancelled ctx. Shutdown is unresponsive for the remainder of the attempt (~65–70 s from the operator's point of view). After the attempt fails/completes, the loop re-checks ctx and returns, andStop()proceeds — at most one attempt's worth of delay.
4. Proof of concept (local, deterministic)
PoC: hunt-v3/stage3/tests/ — TestT38_BenchmarkWallTime (node/, NO -race, 139.40 s), re-run byte-identical at HEAD in an isolated worktree copy with temp data dirs. The -race run was infeasible in V3 (>13 min, killed by a runtime restart — race-detector overhead ~10–15× on this CPU-bound code), so the no-race run is authoritative, exactly as in V3.
Re-run result at HEAD (2026-11-14), same magnitude as V3 (2026-11-11):
| Observation | V3 | Re-run at HEAD |
|---|---|---|
RunBenchmark(seed, 1024) wall |
64.24 s (score 0.0156) | 68.17 s (result.Elapsed 68.167 s, score 0.0147) |
| Stop latency (issued 1 s into a live attempt) | 65.48 s | 70.20 s |
| Mechanism | H-D MECHANISM CONFIRMED |
H-D MECHANISM CONFIRMED |
| Race detector | 0 DATA RACE |
0 DATA RACE |
The ~4 s / ~5 s increases vs V3 are run-to-run CPU variance on the shared VM (same 1024-puzzle workload, same code path); magnitude and mechanism are unchanged.
Log: hunt-v4-followup/stage3-minors/logs/t38-reverify-norace.log. The test files were copied byte-identical (cmp clean; sha256 6c42779aeb57a66bada81445b9174de806f025a8d9196a7761eeb17f894888a7 for node/stage3_lifecycle_test.go).
5. Attacker prerequisites
- None — local only, no attacker. The trigger is a local operator stopping the node during a cert attempt. No remote step, no privilege on the victim. The window recurs at node start and at each renewal, so an operator stopping the node has a realistic chance of hitting it — but hitting it costs only time.
6. Independent validation and false-positive assessment
- Deterministic reproduction, twice: V3 (2026-11-11) and the HEAD re-run (2026-11-14) give the same magnitude (64.24 s → 68.17 s wall, 65.48 s → 70.20 s Stop). The stall is measured wall time, not a pattern match.
- Disproof attempted: (a) checked whether the benchmark or the cert loop checks ctx mid-attempt — neither does; (b) checked whether the stall could be the whole retry chain — disproved, bounded to one attempt by the ctx re-check after a failed attempt; (c) checked whether
waitForAttestationPeerscould extend it — it is ctx-guarded, so no. - Duplicate check (fresh, DB 2,421 entries as of 2026-11-14 ~17:00 WIB): all 7 benchmark/certificate hits are trust reports (forged benchmark scores, unverified work proofs, expired-cert acceptance — XE-4975, xe#354, XE-5677, xe#392, XE-0001/xe#6), not shutdown latency. The closest same-class report is XE-0920 (queued VM provision blocks shutdown — different function, unbounded, stand-in-sleep PoC). XE-0041/xe#60 is a SIGTERM sync hang (different function, no benchmark). xe#348/PR #349 is a wg-registration race on a running node; PR #349 (full body + files list read this run) never mentions
perf/,RunBenchmark,generatePerformanceCertificate,maintainCertificate, orcertGenerationLoop, and adds noStop()timeout — it does not fix this. Classification: NOVEL on public data (private Critical/Severe reports may exist; uniqueness is not guaranteed). Full analysis:duplicate-intel/reports/v4f-hd-benchmark-duplicate-analysis.md.
7. Severity justification (Minor, ceiling 650 XE)
CVSS 3.1: 4.0 (AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L). Attack vector is local (a local operator stopping the node); complexity is Low (stop during a cert attempt — a window that recurs at start and at each renewal); no privileges or user interaction; availability impact is Low (a bounded ~65–70 s unresponsive shutdown; the node stops cleanly afterwards, no crash, no state impact, no funds). The CVSS score sits exactly on the Low/Medium boundary (4.0); the XE tier is Minor because the bounty tier table prices this class — a bounded shutdown delay with no remote trigger and no lasting effect — as Minor, and the CVSS number is informational here.
Why not higher: the delay is bounded to one attempt, the node always stops cleanly afterwards, and nothing is lost or corrupted.
8. Fix suggestion
Make the benchmark ctx-aware: chunk the 1024 puzzles with ctx checks between chunks (or pass the ctx into RunBenchmark/runCPUChain), so Stop()'s cancel interrupts the attempt — or run the cert attempt outside n.wg with a timeout so Stop() does not wait it out. Either fix must keep the certificate issuance semantics (a cancelled attempt simply retries on the next cycle, as the existing between-attempt re-check already does).
9. Caveats (kept in the report)
- The
-racerun is infeasible (>13 min, killed in V3); the no-race numbers are the production-relevant ones. - The ~4–5 s increases vs V3 are run-to-run CPU variance on the shared VM, not a code change.
- The stall is bounded to ONE attempt by the ctx re-check after a failed attempt; it is not the whole retry chain.
- NOVEL means no matching public finding as of the 2026-11-14 ~17:00 WIB check (DB 2,421 entries); private reports may exist.
10. Reproduction (for the committee)
Local only, worktree copy at 89a542e, isolated temp data dirs:
export PATH=~/workspace/go/go/bin:$PATH
export TMPDIR=~/workspace/xe-bounty/.tmp
cd <worktree>/node
go test -count=1 -timeout 20m -run 'TestT38_BenchmarkWallTime$' -v ./...
# Expected: PASS (exit 0), ~140 s — read the numbers from the log:
# RunBenchmark wall ~68 s, Stop latency ~70 s, H-D MECHANISM CONFIRMED.
# Do NOT add -race (infeasible on this CPU-bound code, >13 min).
PoC: hunt-v3/stage3/tests/ (node/stage3_lifecycle_test.go). Log: hunt-v4-followup/stage3-minors/logs/t38-reverify-norace.log. Full analysis: hunt-v3/stage3/STAGE3_VERDICT.md §H-D; duplicate analysis: duplicate-intel/reports/v4f-hd-benchmark-duplicate-analysis.md.
Thread
Thanks for the report. We have read it against the code and confirmed the behaviour you describe. It is being handled, and this ticket will be updated when there is a change to check.