Repository navigation
Description
What's the problem
The remainder of pithead#4076 after PR #4093 (merged: monerod_redial.py re-dials monerod after any Tor start and restarts a peerless monerod, with REDIAL_SETTLE_SEC, WATCHDOG_GRACE_SEC, COOLDOWN_SEC 30 min, DAILY_CAP 3). A monerod with live outgoing peers that stores no block still never recovers on its own: the 2026-11-14/15 wedge ran 06:21-06:39 (18 min) with three peers announcing a 32-38 block lead, and any non-zero peer reading clears both the pending re-dial (monerod_redial.py:75) and the zero-peer clock behind the peerless verdict (monero_health.py:80). MoneroChainHealth already computes stalled (STALLED_SEC 30 min, monero_health.py:24) but nothing acts on it, and its clock runs through a Tor outage. The owner moved this remainder to v2.0.5 with #4076 on 2026-11-16.
What it impacts
Every appliance whose node wedges while its connections stay open: rigs hash a stale tip and revenue is lost until a human restarts monerod. The healer's own restart and the redial watchdog can also cycle monerod back to back because their budgets are separate.
How I found it
This is a split chunk of #4076 handed to a local session whose group was too large; the acceptance items are the ones appended to #4076 from the 2026-11-14/15 incident evidence comment and restated in the owner's 2026-11-16 ruling. Verified against develop 67504c5.
How important is it
P1 user-facing, v2.0.5 scope by owner direction (inherited from #4076).
Acceptance criteria
- Height-stall trigger: a monerod whose target height is above its height while the height stays unchanged for 10 min (a named constant) is restarted alone, even with live outgoing peers. Unit tests: brief peer readings do not defeat it; a sequence modelled on the incident (height frozen, target 32-38 above) fires once.
- Tor gate: the trigger runs only while Tor is proven — bootstrap 100% and a completed-circuit reading for 5 consecutive minutes (a named constant); the stall clock starts when Tor becomes proven, never when the height last moved. Unit test: height frozen through a Tor outage does not fire at the moment Tor recovers.
- Sync state: during initial sync, or when target height minus height exceeds a named block gap, a longer named threshold applies, and the trigger never fires while the height is advancing. Unit tests for each branch.
- Peer gaps: a peer gap shorter than a named number of seconds pauses the stall clock without resetting it and never fires (the 3-6 s gaps at 06:43:28 and 06:44:58 were normal). Unit test: repeated brief gaps during a frozen height still reach the threshold.
- Shared limits: one cooldown and one daily counter cover this trigger, the Re-dial monerod after any Tor start; restart a peerless monerod within bounds (#4076) #4093 peerless watchdog, and the healer's monerod restart after its own Tor restart (monerod loses all peers when the tor container is recreated, and nothing notices #972, the
_restart_monerodbranch of tor_heal.py's check()). Unit test: after one of the three fires, the other two are held by the same cooldown and counter. - Safety and record: never restarts P2Pool, never touches chain data; before acting it records height, target height and peer counts (no addresses) in the audit row or log; keep the LAN guard on the *_lan_access ports is not restored at boot: DIY Docker hosts publish them to every source until ./pithead up #2749 guard (only a running local monerod is cycled; monero.mode remote is never touched). Unit test on the recorded fields.
- Out of scope: the tests/os KVM leg (moved to KVM leg: a stranded or peerless monerod is re-dialled and restarted within bounds on the appliance (split from #4076) #4157) and the NEWNYM/tor-recover ladder (Tor auto-heal ladder: rejected NEWNYM must advance to state reset and Tor restart; detect saturation directly #4075).
Possible solutions
- Extend MonerodRedial with the stall rule using the verdict plus target height from the same get_info reading; all thresholds are module-level named constants.
- Extract the cooldown + rolling daily counter from monerod_redial.py into a small shared limiter consumed by the healer too. tor_heal.py is being rewritten for the NEWNYM ladder on PR Tor auto-heal: advance past a rejected NEWNYM to state reset and restart (#4075) #4095 — check its state first and land on top of whatever merged.
- Read "Tor proven" from the existing Tor probe surfaces (the healer's control-port reads, or Tor's bootstrap/completed-circuit log lines); decide one and document it.
- Unit tests under dashboard/tests/service/health/, red before green after.
Parent: #4160
Worker brief: Test tier: tier4-e2e (fault phase) plus tier-1 pytest for every named branch (these are pure-logic thresholds with an injectable clock, so each criterion in the issue body gets a dashboard/tests/service/health/ case that is red without the fix).
Objective: the #4076 remainder exactly as listed in the acceptance criteria — height-stall trigger (10 min named constant, target above height), Tor-proven gate (bootstrap 100% plus a completed-circuit reading for 5 consecutive minutes, clock starts when Tor becomes proven), longer threshold during initial sync or a large height gap, short peer gaps pause without resetting, one shared cooldown + daily counter across this trigger, the #4093 peerless watchdog and tor_heal.py's #972 monerod cycle, and a pre-action record of height, target height and peer counts (no addresses).
Start by checking PR #4095 (#4075, open at split time) — it rewrites tor_heal.py, the file the healer's #972 restart lives in; land on top of whatever merged. Keep the #2749 guard and remote-mode rule; never touch P2Pool or chain data; ship the trigger for all roles (the owner's CI-role question was never made a criterion — the default is to include CI instances). Update the docs that describe #972 and the redial behaviour, not the code with comments. The PR body carries Closes #4076 on a line of its own plus its own child issue's keyword, and quotes the tier4-e2e job on the final head with the unedited bench-ci evidence block.
Activity
pithead-developer commentedon Nov 19, 2026
Grouped with #4191, but PR #4256 does not close it: the worker left it out. Released for its own pick.
pithead-developer commentedon Nov 22, 2026
Grouped with #4346, but PR #4350 does not close it: Already delivered by merged PR #4200 (its body carried Closes #4192), so no further change is needed here; the issue is still open and can be closed.. Released for its own pick.
pithead-developer commentedon Nov 22, 2026
Verified as delivered, closing.
PR #4200 (merged 2026-11-21, commit d8de0ad, on develop-v2.0.5) implements every acceptance criterion of this issue: the 10-minute height-stall restart that fires with live outgoing peers, the Tor-proven gate (bootstrap 100% plus a completed-circuit reading for 5 consecutive minutes, with the clock starting when Tor becomes proven, never when the height last moved), the longer sync threshold during initial sync or a large target gap, short peer gaps that pause the stall clock without resetting it, one shared cooldown and daily counter covering the stall trigger, the #4093 peerless watchdog and the tor healer's #972 monerod cycle, and the pre-action audit of height, target height and peer counts. The unit tests cover each named branch red-to-green, and the tier4-e2e monero-stranded job on the final head is green with every row quoted in the PR.
No further change is needed here (runner note of 2026-11-22).
pithead-developer commentedon Nov 22, 2026
Questions before work continues (answer here, then remove the
questionlabel):The local session reported this issue too big and proposed a split, but the runner refused it: the parent issue is unreadable, closed or not the runner's. Split it by hand or give the local session a narrower brief.