Repository navigation
Description
Summary
decdn-node does not bind its /metrics (9090) or admin RPC (9191) listeners until the buyer-side PaymentChannel bootstrap completes. On startup that bootstrap synchronously awaits a one-time USDC approve receipt; when the tx is slow to confirm (slow/flaky RPC, congested chain, underpriced/stuck tx) it blocks for many minutes — ~27 min observed on a live Arbitrum-Sepolia node — during which the node is otherwise healthy (QUIC udp/4433 listening, isActiveNode=true, NRestarts=0) but has no metrics/admin surface and never logs "node runtime ready".
Impact
- Operational blind spot:
/metricsscraping anddecdn node health/ admin RPC are unavailable for the whole window on a healthy, serving node. - Breaks deploy/readiness automation. Worked around downstream in
decdn/devopsby making the Ansible/metricsreadiness probe advisory (fix(decdn_node): make the /metrics readiness gate advisory (no false-fail) devops#26), but the root cause is here.
Root cause — startup ordering in crates/node/src/runtime/mod.rs::run()
- The iroh/QUIC endpoint binds early (
build_endpoint, ~L615) — hence QUIC is up almost immediately. - The buyer PaymentChannel bootstrap is awaited synchronously at L1161–1182 →
ensure_allowance(crates/node/src/buyer_channel.rs:278) →crates/client-pull/src/buyer_channel.rs::ensure_allowance, which awaits:erc20.approve(spender, U256::MAX).send().await?.get_receipt().await?
get_receipt()blocks until the one-timeapproveis mined. - Everything after that await is gated behind it: router spawn (L1199), DHT bootstrap (L1213), metrics bind (L1228), admin bind (L1443), and finally
"node runtime ready"(L1792).
The comment at L1130–1133 explicitly states the buyer bootstrap is non-fatal and "must not block the node's core seller function" — but by sitting synchronously ahead of the observability/admin binds, it blocks all visibility into that function. Notably, the reclaim loop (buyer_channel.rs:295) and orphan reconciler (:316) in the same bootstrap are already spawned as background tasks — the blocking approve is the outlier.
Suggested fix (either or both)
- Bind metrics + admin (and spawn the router) before the buyer bootstrap await, so observability comes up independent of the buyer/chain path.
- Background the buyer bootstrap (spawn it like its own reclaim loop — its failure path already says "restart to retry") and add a bounded timeout on the
approveget_receipt()so a stuck tx never hangs even the buyer lane.
Repro
Point a node at an RPC/chain where the one-time USDC approve is slow to confirm (or the wallet's first approve is underpriced so it sits pending). Observe /metrics refusing connections and no "node runtime ready" log line for many minutes, while QUIC serves and the systemd unit is active (running).
Activity
fix(node): bind metrics/admin before the buyer PaymentChannel bootstr…
fix(node): the openChannel receipt must NOT be bounded (#1143 review)
fix: bound the requester's fetch loop, and classify what comes back (#…
fix(node): gate listeners on blacklist sync (#1275)