Repository navigation
Description
Migrated from SergioDemianLerner/rustock#108 (pull request by @SDL-A1, 2026-09-24).
Merged: yes. The commits are already in this repository's history.
Original: SergioDemianLerner/rustock#108
Fixes the 13m40s mainnet stall of 2026-09-24 15:41–15:55. Evidence: /root/doc/incident-2026-09-24-follow-mode-body-stall.md.
What happened
The node sat 12 to 22 blocks behind with nothing in flight, holding headers and canonical entries for blocks whose bodies it had never received. It escaped only when the network's own progress carried it past LONG_SYNC_LIMIT and skeleton sync took over — which then fetched all 25 bodies in 385 ms.
820 seconds stuck; 385 milliseconds to fix once it tried.
The hole
request_follow_bodies asks only for the bodies of headers that just arrived. When one of those requests goes unanswered, expire_stale_follow_bodies drops it and nothing re-issues it. Its comment says "the next tip will re-request the body" — but the next tip brings its own header, not the lost one. The block stays header-only for good.
Every other guard measures a difference that is zero in that state:
| guard | compares | during the stall |
|---|---|---|
leave_follow_if_backlog |
downloaded head vs executed head | both #9,267,974 → 0 |
check_execution_progress |
execution stopped while blocks wait | nothing waiting by its measure |
check_follow_gap |
our height vs peers | the only peer-relative check, gated at 25 |
fill_follow_body_gap looks for what's actually wrong: a canonical block above the executed head that we hold a header for, with no body, and nothing in flight.
Why the watchdog couldn't clear it
Φ measured exactly the right thing — behind 12, behind 17, behind 22, no progress — and escalated four times. Each escalation called restart_round; try_start_sync then found the gap under LONG_SYNC_LIMIT and put the node straight back into follow mode with no requests issued.
Escalation and Near tip (N blocks behind), entering follow mode share a timestamp in the log, every time. The recovery worked and follow mode undid it on the same tick.
I considered routing small gaps through the skeleton path instead, and rejected it: on_skeleton_response bounces back to follow mode when the skeleton has fewer than 2 entries, which would rebuild the same loop for short ranges.
Why it's safe to run every tick
A canonical block with no body is the ordinary state for the moment between a header arriving and its body answering — and during that moment the request is in pending_follow_bodies. Requiring that map to be empty separates "the request was lost" from "the request is young".
Three tests: the stall shape re-requests all four missing bodies (confirmed to fail without the fix), an outstanding request suppresses it entirely, and a node holding every body stays silent.
Whole workspace: 21 suites, 0 failures.
Still open (in the incident doc)
Coherence violation I5 contradicted the store. For 820 seconds it reported the executed head "is not the canonical block at its height", while a live query showed canonical_hash(9267974) equal to the executed head with a linked chain above. Either the message is inaccurate about what it checked, or the unresolved timer re-prints a first-seen violation without re-evaluating. It sent the first pass of this investigation to the wrong place, which is worse than not reporting.
🤖 Generated with Claude Code
Activity