Skip to content

decdn-node hangs in router.shutdown() on SIGTERM after any node-to-node pull; SIGKILL skips redeem and lane flush #2185

Closed

Description

@thiras

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():

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

  1. Run a node that does at least one successful serve-miss node-to-node pull (a two-leg miss).
  2. systemctl stop decdn-node.

A standalone repro that uses iroh 1.0.0 only hangs for more than 20 s:

  1. On a separate thread, dial from inside a current-thread runtime.
  2. Close the connection, then drop that runtime.
  3. 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.

  1. Serve-miss pull legs run on a throwaway new_current_thread runtime on a dedicated thread (crates/node/src/handlers/client/window.rs:417-426, crates/node/src/node_origin/mod.rs:1910).
  2. An upstream dial made inside that runtime (a PeerSource gap fill) spawns its noq ConnectionDriver on it, because iroh's runtime spawn uses the current tokio context.
  3. When the leg returns, the runtime drops and the driver drops with it.
  4. noq's State::drop emits only Drained, never Draining. So the endpoint's active_connections never decrements.
  5. iroh Router::shutdown → Endpoint::close() → wait_all_draining() (iroh socket.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

  1. Root fix: keep connection drivers off the short-lived runtime. Dial upstream connections on the main runtime, for example main_handle.spawn(endpoint.connect(..)).await inside the PeerSource gap 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.
  2. Defence in depth: wrap router.shutdown() (crates/node/src/runtime/mod.rs:2572) in tokio::time::timeout(SHUTDOWN_DEADLINE, …) and warn! on timeout. Then the redeem sweep, lane flush, receipt flush and cache.shutdown always run. A stuck iroh close must never cost settlement state.
  3. Observability: count drivers stranded on the success path, so abandon_drain_timeout_total stops reporting a false zero.
  4. 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.

Activity

  1. added
    kind:bug
    prio:high
    rust
    area:node
    on Sep 27, 2026
  2. self-assigned this
    on Sep 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:nodekind:bugprio:highrust

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions