Skip to content

node: the metrics listener binds only after the boot chain reads, so a node stuck in boot exports nothing #2819

Closed

Description

@thiras

Component

node

Version

v0.3.1

Network

Arbitrum Sepolia testnet (our fleet, 8 nodes)

Problem

decdn-node binds the /metrics listener in spawn_background_tasks (crates/node/src/runtime/mod.rs). That function runs after build_infra and build_chain_and_handlers, so the listener only starts after every startup RPC read succeeds:

  1. the RPC reachability preflight (check_rpc_reachability, up to 5 attempts),
  2. the deployment preflight (check_deployment_preflight, 1 min BootRetry budget),
  3. the fail-closed boot chain reads (CapacityBond registry, slash enumeration, usdc() self-check, blacklist enumeration, sharing the 10 min BOOT_CHAIN_RETRY_BUDGET).

While any of these retries, nothing listens on the metrics port. A node stuck in boot looks the same as a node that is down. decdn_chain_boot_read_retries_total, which counts exactly these retries, can be scraped only after boot completes. chain_events/boot_retry.rs says so in its module docs.

Observed on the fleet (2026-11-01)

  • 12:08:35 UTC: all 8 nodes restarted. Each one then failed eth_getCode at the lagged snapshot block (error code 27: Unknown state. First available state is 1), used up the 600 s budget twice (gave up after 15 attempts in ~543s), and exited. The third start, at 12:31:51, was ready in ~9 s.
  • 12:31:52 to 12:36:06 UTC: lon1's RPC returned 401 Unauthorized (a fatal preflight result), and the node crash-looped about 46 times.
  • Prometheus has no decdn_* samples from any node between about 12:10 and 12:32 (lon1: until 12:36). The only boot signal during the outage was the per-attempt WARN in Loki.

Proposed fix

Bind and serve the metrics listener at the top of run, before build_infra. node_metrics already exists there (the caller builds it), and metrics::serve encodes the shared registry on each scrape, so collectors registered later (iroh endpoint, probe holds, cache) appear once they attach. Move metrics_stop_tx and the serve task out of Background into the early phase, and keep the shutdown order unchanged.

Follow-up worth considering in the same change: a boot-phase gauge (for example decdn_node_boot_ready 0/1, or the current boot step), so "stuck in boot" can be alerted on directly instead of inferred from the retry counter. A new metric needs its ADR appendix-observability row and a devops panel.

Then update the boot_retry.rs module docs. The "scrapeable only once boot completes" note no longer holds.

Out of scope

  • Whether the snapshot should fall back to a head pin when the endpoint has pruned state at head - SNAPSHOT_LAG_MARGIN_BLOCKS (the cause of the 12:08 boot loop). Tracked separately if we pursue it.
  • The instant exit on a fatal (4xx) preflight result. That is intended fail-fast behavior.

Activity

  1. added
    kind:bug
    prio:medium
    area:node
    on Nov 1, 2026
  2. self-assigned this
    on Nov 1, 2026
  3. moved this from Backlog to In progress in deCDNon Nov 1, 2026
  4. moved this from In progress to Done in deCDNon Nov 1, 2026
  5. added a commit that references this issue on Nov 3, 2026
    034f8a7
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:medium

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions