Repository navigation
Description
Component
node (decdn-node daemon)
Version
06955a38 (testnet deploy 2026-09-27 21:56 UTC); every build since at least 2026-09-25.
Operating system
Ubuntu, systemd unit decdn-node.service (TimeoutStopUSec=5min), testnet fleet.
Summary
After SIGTERM, decdn-node stays in router.shutdown() until systemd SIGKILLs it at the 5-minute stop timeout. This happens on every node that finished at least one node-to-node pull since it booted. The SIGKILL skips every shutdown step after router.shutdown():
payment_service.shutdown, the final redeem sweep (Implement on-chain CapacityBond and PaymentChannel contract integration #327)- the final
channel_state_store.flush() - the receipt-writer tail flush (node: audit-only download-receipt write is awaited on the paid-delivery hot path #803)
- the warming-credit flush
cache.shutdown
Each deploy costs 5 minutes of downtime per busy node. It also loses any lane frontier and receipts written since the last background flush.
Steps to reproduce
- Run a node that does at least one successful serve-miss node-to-node pull (a two-leg miss).
systemctl stop decdn-node.
A standalone repro that uses iroh 1.0.0 only hangs for more than 20 s:
- On a separate thread, dial from inside a current-thread runtime.
- Close the connection, then drop that runtime.
- Call
router.shutdown()on the main runtime.
If the program instead waits until the connection's background task has finished before it drops the runtime, the shutdown takes 394 µs.
Expected behavior
The node shuts down within SHUTDOWN_DEADLINE (15 s) and runs the redeem, flush and receipt steps.
Actual behavior
The last line the daemon logs is shutdown signal received; closing router (crates/node/src/runtime/mod.rs:729). After that, only the chain poller logs, because the poller stops after router.shutdown. Host CPU stays at about 1% for the full 5 minutes, so the process waits and does not spin. systemd then logs State 'stop-sigterm' timed out. Killing.
Evidence from the journal:
| Deploy (UTC) | Hung (SIGKILL after 5 min) | Clean stop |
|---|---|---|
| 09-25 19:51 | fra1, lon1, nbg1 | hel1 |
| 09-25 23:17 | — | fra1, lon1, hel1, nbg1 (no pulls since boot) |
| 09-26 20:27 | fra1, lon1, hel1, nbg1 | |
| 09-27 04:13 | fra1, lon1, hel1, nbg1 | |
| 09-27 09:58 | fra1, lon1, hel1, nbg1 | |
| 09-27 21:57 | fra1, lon1 | hel1, nbg1 (no pulls since boot) |
bcl never hangs. It serves from its own origin and makes no upstream iroh dials. A node hangs exactly when it completed a node-to-node pull since boot. No commit introduced this on 09-25: the hang follows traffic.
Root cause
This is the success-path case of #1675.
- Serve-miss pull legs run on a throwaway
new_current_threadruntime on a dedicated thread (crates/node/src/handlers/client/window.rs:417-426,crates/node/src/node_origin/mod.rs:1910). - An upstream dial made inside that runtime (a
PeerSourcegap fill) spawns its noqConnectionDriveron it, because iroh's runtime spawn uses the current tokio context. - When the leg returns, the runtime drops and the driver drops with it.
- noq's
State::dropemits onlyDrained, neverDraining. So the endpoint'sactive_connectionsnever decrements. - iroh
Router::shutdown→Endpoint::close()→wait_all_draining()(irohsocket.rs:~1164) then waits forever.
crates/node/src/node_origin/abandon_drain.rs:45-51 ("What is not covered") already says a clean UpstreamPull::finish strands its driver. ConnDrain covers only the cancel and error paths, so decdn_node_pull_abandon_drain_timeout_total stays at 0 while this happens on every successful leg.
Fix
- Root fix: keep connection drivers off the short-lived runtime. Dial upstream connections on the main runtime, for example
main_handle.spawn(endpoint.connect(..)).awaitinside thePeerSourcegap dial, the same way the primed handshake already does (pull_leg.rs:648-650). Or fix Pull legs run on ephemeral per-serve runtimes, stranding shared connection drivers (HTTP + QUIC) #1675 with a long-lived pull runtime. - Defence in depth: wrap
router.shutdown()(crates/node/src/runtime/mod.rs:2572) intokio::time::timeout(SHUTDOWN_DEADLINE, …)andwarn!on timeout. Then the redeem sweep, lane flush, receipt flush andcache.shutdownalways run. A stuck iroh close must never cost settlement state. - Observability: count drivers stranded on the success path, so
abandon_drain_timeout_totalstops reporting a false zero. - Regression test: a two-endpoint loopback that dials inside a current-thread runtime and drops it, then asserts that the node's shutdown finishes within the deadline.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity