Skip to content

Prod Tor client wedged for 15 h: Monero node peerless and tor auto-heal never escalated past a rejected NEWNYM #4045

Open
5 of 5 issues completed

Description

@pithead-developer

What's the problem

On the owner's production appliance (v2.0.2), the Tor client wedged on 2026-11-11 and stayed wedged for more than 15 hours. Over that time the Monero node had no peers, and nothing on the box recovered it.

  • 09:27:30Z: monerod logged "monerod is now disconnected from the network" and froze at its height. By 11-12 00:30Z it was about 480 blocks behind. Three brief reconnects (14:42, 16:06 and 19:43Z) each started a sync and dropped within 1–2 minutes.
  • Tor at 11-12 00:24 and 00:34Z:
    • "We'd like to launch a circuit to handle a connection, but we already have 32 general-purpose client circuits pending", with 24,039 and then 25,136 similar messages suppressed per 11 minutes;
    • a continuous storm of "Giving up on launching a rendezvous circuit";
    • "No more HSDir available to query";
    • "All current guards excluded by path restriction type 2".
  • The dashboard logged "Tor clearnet egress failed for 883 minutes" and requested NEWNYM. The host control runner rejected it ("NEWNYM budget or cooldown"). That NEWNYM-then-reject cycle repeated every ~35–40 minutes all day. tor auto-heal never escalated to a Tor restart.
  • The same signature hit a bench primary on 2026-09-26. It was cured by restarting tor and then the node, so this is the second occurrence.

Two CI nodes running the same Tor-only stack over the same 20-hour window logged no rendezvous give-ups and at most one pending-circuit line, and stayed synced. So this was the appliance's Tor client, not the Tor network.

What it impacts

  • Mining revenue: about 15 hours of the owner's whole fleet, about 250 kH/s. See the companion issue on serving stale work.
  • Alerting: Telegram notifications go through Tor, so the node-down alert could not leave the box. The only signal was Healthchecks going quiet (DOWN 09:47–12:24 and 12:42–13:32Z).
  • Every appliance with tor.auto_heal: true: the healer's NEWNYM budget runs out, and it has no next step.

How I found it

How important is it

High. It recurs, it is silent (the dashboard shows hashrate and green Tor-only egress while the node is offline), and it costs every hash until a human notices and restarts by hand.

Acceptance criteria

  • The 09:26–09:27Z trigger is identified from the appliance journal and Tor state, or documented as not recoverable, naming what to capture next time.
  • When Tor clearnet egress has failed for longer than a bounded window and NEWNYM is rejected or does not help, auto-heal escalates to a Tor restart, with a cooldown and a cap per day. It then re-dials monerod (restart monerod) if monerod stays peerless or out of sync.
  • A saturated client ("circuits pending" at the limit) is detected directly and counts as unhealthy for that escalation.
  • A fault-injection test (KVM or stack) reproduces a wedged or saturated Tor client and proves the stack returns to a synced node without a human, within the bounded window.
  • When Tor egress is down, at least one alert path that does not depend on Tor reaches the owner: a dashboard banner naming "Monero node offline", and the Healthchecks dead-man behaviour documented as the backstop.
  • On a Tor failure, the support bundle (Let appliance owners download a redacted support bundle of past logs from the dashboard, and log why health pings fail #4032) captures Tor's bootstrap, guard and circuit state.

Possible solutions

  • An escalation ladder in tor-heal: NEWNYM, then a Tor reload or guard reset, then a Tor container restart, each gated on the egress probe staying failed. Also a monerod re-dial after Tor recovers.
  • Read GETINFO status/circuit-established and the pending-circuit count over the control port as a health signal, rather than relying only on the HTTP egress probes.
  • Check whether P2Pool and Tari onion-peer churn (rendezvous attempts) is driving the saturation, and whether MaxClientCircuitsPending or per-client limits help.
  • Unknown: whether this is cause or effect. The rendezvous storm may be a symptom of a dead guard or HSDir view rather than its trigger.

Private evidence (raw logs, addresses) is kept by the operator, outside GitHub.

Sub-issues

Sub-issues

5 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. added this to the v2.0.4 milestone on Nov 12, 2026
  2. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Lead from the post-reboot logs (2026-11-12): after a clean restart, Tor reached "Bootstrapped 100%" at 00:40:38 and logged "32 general-purpose client circuits pending" 12 seconds later. The Tor render runs monerod with out-peers=48 (config.reference.json monero.out_peers: 48; the clearnet render uses 32). Tor's default MaxClientCircuitsPending is 32. With Tari and P2Pool onion peers also dialing, a fresh boot already sits at the pending-circuit ceiling. That makes a slow guard or HSDir hiccup the likely tipping point into the wedge. Worth testing: out-peers 16–24 over Tor, and/or a raised MaxClientCircuitsPending, under the fault-injection test this issue asks for.

  3. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Owner direction (2026-11-12): this is a project-breaking failure. v2.0.4 must ship automated fixes, guard rails and heavy testing for it. This issue, #4046, the config-debt rows of #4047, and #4032 are now release-blocker for v2.0.4.

    A second failure mode, found tonight on a CI pithead (the fleet's backup pool, on the 2.0.3 cut):

    • Its P2Pool has logged "no connections to other p2pool nodes" about 180 times an hour since 2026-11-11 10:04Z, with no new sidechain tip since then.
    • Monerod and Tor were healthy there.
    • Two other CI stacks over the same window kept their P2Pool peers.
    • So P2Pool can lose every onion peer and never re-dial, even without a wedged Tor. A docker restart p2pool is the manual cure (verification in progress).

    What "done" must include beyond the acceptance criteria above:

    • Auto-heal ladder covering all three failure modes:
      • Tor saturated or wedged: escalate NEWNYM → Tor restart → monerod re-dial;
      • monerod peerless for more than N minutes: restart monerod;
      • P2Pool with zero peers for more than N minutes: restart P2Pool.
    • Bounds on every step: a cooldown and a daily cap, an audit-log entry, and an owner-visible status line.
    • Guard rails:
    • Heavy testing:
      • fault injection in the KVM appliance lane and the e2e lane for each mode: saturate Tor's pending circuits, black-hole Tor egress, cut all P2Pool peers, freeze monerod's peers;
      • each must recover to a synced node and a P2Pool with peers, unattended, within the bounded window;
      • plus a multi-hour soak with periodic injected faults.
      • All of it runs in the 2.0.4 release gate, not only in CI.
  4. added
    release-blocker
    on Nov 12, 2026
  5. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Confirmed again tonight on the backup pool: a manual Tor restart (./pithead restart tor) left monerod disconnected from the network ("monerod is now disconnected" 3 seconds later). It did not reconnect for 14 minutes, until ./pithead restart monerod. Its chain froze at one height meanwhile, while it kept serving work to 6 rigs. Acceptance addition for the ladder: every Tor restart, manual or automatic, is followed by a monerod re-dial once Tor reports a circuit, and the guard from #4046 covers the gap.

  6. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Investigation summary (2026-11-12)

    Scope: the production appliance (v2.0.2, Tor 0.4.9.14) and a CI Pithead (2.0.3, Tor 0.4.9.15). Read-only investigation; nothing was changed on any host.

    What happened

    • The production appliance lost all monerod peers, Tor reported "32 general-purpose client circuits pending" with a rendezvous give-up storm, "No more HSDir available" and guard path-restriction errors. A reboot did not help. Roughly 15 h of fleet hash went to a stale tip.
    • A CI Pithead later stuck at Tor "Bootstrapped 95%" for ~15 min. Moving only Tor's state file aside gave 100% in 3 s, and restarting monerod resynced it in seconds.
    • Fresh onion (HSDir) lookups fail on every stack we checked. A restarted P2Pool (onion-only peering) cannot find peers and mines a private sidechain. Clocks and the consensus (same, fresh, ~2.9k HSDir relays) are fine on all hosts.

    Verified

    • The heal ladder deadlocks: the host allows 2 NEWNYM per 24 h; once spent, the rejection is "refunded" as unconfirmed, so attempts never reach the restart/recover rung. Same code in v2.0.2, v2.0.3 and develop.
    • The heal trigger is a clearnet probe only. Nothing probes onion/HSDir reachability, pending circuits, or P2Pool peers. The Tor container healthcheck is bootstrap-only and Docker restarts nothing on "unhealthy".
    • A Tor state-reset step exists (tor-recover) but only fires on an exact "saturated state" signature plus a 6 h cooldown; the production evidence did not show that signature.
    • A Tor restart by anyone other than the healer does not re-dial monerod.
    • A peerless or stale monerod only alerts. Only RPC-unreachable stops xmrig-proxy, so rigs keep getting stale work. The worker table reports rig-to-proxy connectivity, not "mining a valid tip".
    • Alerts go through Tor, so they fail during the outage. Only the Healthchecks ping reached the owner.
    • Log pull is capped at 200 lines / 64 KB per container and Docker keeps 3 x 10 MB, so storm evidence rotates away.
    • Torrc leaves MaxClientCircuitsPending at 32 while monerod runs 48 out-peers over Tor. Tor is unpinned (version moves with the base image). P2Pool runs with --no-dns and no rendered --addpeers.
    • Hosts with identical consensus differ widely in fresh HSDir failure rates; earlier stuck/saturated Tor state backups exist on CI hosts, so this class has recurred.

    Inferred or open

    • The trigger looks shared/external (a CI host showed the same storm in the same hour as production), so "not a Tor network problem" is not established. Leading hypotheses: stale guard/directory state plus heavy single-client load (medium-high); upstream directory/HSDir degradation, possibly related to new 0.4.9.15 directory-request defenses (low-medium); descriptor decrypt failures in 0.4.9.x (low).
    • No public Tor incident for 2026-11-11..12 was found (weak evidence). Unknown: what happened at the start of the event, and whether production clearnet failure had the same cause.

    v2.0.4 plan

    Must-have:

    Should-have: #4047 doctor/dashboard rows (onion reachability, P2Pool peers and private-sidechain detection, pending circuits); #4048 per-row "serving" truth; non-Tor alert ping on stale tip; circuit cap and SOCKS isolation tuning; --addpeers seeds; Tor version pin.

    Test plan

    Fault injection in KVM and e2e: NEWNYM budget exhausted, bootstrap stuck at 95%, onion-only failure, external Tor restart stranding monerod, pending-circuit saturation, P2Pool peer loss, stale-tip shedding (with and without the external reference), log bundle integrity/redaction/size, Tor-independent alerting; then a 72 h soak with repeated random Tor state corruption, and a Tor 0.4.9.14 vs 0.4.9.15 regression.

    Verified by hand: in dashboard/mining_dashboard/service/health/tor_heal.py a non-applied NEWNYM result calls refund_attempt(), so MAX_ATTEMPTS = 3 ("two circuit refreshes, then one container restart") is never reached while the host keeps rejecting NEWNYM.

  7. pithead-developer commented on Nov 12, 2026

    @pithead-developer
    ContributorAuthor

    Recovery data point (2026-11-12): on the CI Pithead now serving the fleet, P2Pool rejoined the public mini sidechain at 01:31:12Z. That was ~16 minutes after a fresh-state Tor restart and a P2Pool restart (01:15Z), with no other change. "No more HSDir available" lines continued at a reduced rate (1–5/min, down from a constant storm), so onion lookups were degraded but partly succeeding. This fits a transient onion-side degradation combined with stale client state, and argues for a heal that keeps retrying P2Pool peering with backoff rather than giving up.

  8. added
    tracker
    on Nov 13, 2026
  9. pithead-architect commented on Nov 13, 2026

    @pithead-architect

    A local session judged this too big for one local session (Too big for one local session: the owner's 2026-11-12 direction makes this issue three failure-mode auto-heal watchdogs (Tor ladder, monerod re-dial/peerless, P2Pool zero-peer) plus a Tor config guard rail and a non-Tor alert path, spanning dashboard Python, host control verbs, build templates and f). The runner filed 5 chunks as sub-issues and marked this issue a tracker, so it is not picked again:

  10. pithead-developer commented on Nov 16, 2026

    @pithead-developer
    ContributorAuthor

    Owner ruling 2026-11-16 (2.0.4 scope review, "all as recommended"): for 2.0.4 this tracker closes when #4075 lands. The #4076 remainder (height-stall trigger and shared limits) moved to v2.0.5, and its re-dial and peerless watchdog are already merged (#4093).

  11. pithead-developer commented on Nov 17, 2026

    @pithead-developer
    ContributorAuthor

    Related evidence from bench-ci#2193: tier4-e2e job 4214@6097fa47e4bb23e059a157dc8980549a2511000d (fault-injection) lost its mining witness because the dashboard stopped xmrig-proxy at 10:00:17 UTC, logging 'Monero node has 0 outgoing peers for 10 min'. monerod had been restarted at 09:40:50 and never obtained a peer through Tor in that window; the dashboard's own monerod re-dial followed at 10:06:46. Same peerless-Monero-over-Tor family; no new issue filed.

  12. removed
    release-blocker
    on Nov 21, 2026
  13. pithead-architect commented on Nov 21, 2026

    @pithead-architect

    The fix, the Tor auto-heal ladder in #4095, merged to develop on 2026-11-21 and ships in 2.0.4. What remains is the owner checking it on prod after 2.0.4 is installed, so this now waits on the release gate #4302 rather than gating it, and the release-blocker label is removed.

  14. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Post-2.0.4 evidence from the production appliance's support bundle (72 h to 2026-11-27). The appliance upgraded to 2.0.4 on 2026-11-26.

    • Two short heal bursts after the upgrade reboot (verified, audit log). The healer acted for about 15 minutes starting 13 minutes after boot, went quiet for 42 minutes, then acted for about 15 minutes more (73 minutes first row to last, 8 rounds). Each burst opened with a rejected tor-newnym, then a tor-history read every 5 minutes. No repeat NEWNYM was sent. Tor was healthy at collection (bootstrap 100, circuit established).
    • Why NEWNYM was rejected (inferred). The reason text is not in the bundle. The budget fits the timing: 2 NEWNYM were applied 19 to 20 h earlier, on 2026-11-25. The rule rejects at 2 in 24 h, or under 30 minutes after the first (lib/pithead/49-control-request-loop.sh:18-23).
    • No escalation seen (verified for the audit log). There is no tor-recover and no tor-heal-exhausted. Both bursts ended before the 30-minute cooldown that the next rung needs (dashboard/mining_dashboard/service/health/tor_heal.py:29,309-321). So this does not show that the ladder advances after a rejected NEWNYM.
    • No restart seen (inferred). A restart normally follows tor-recover, but the dashboard service log is not in the bundle. It cannot rule out a restart that skipped tor-recover (:316-334). History reads continue only while attempts are open (:277). The bursts probably ended because probes recovered (:133-147, inferred).
    • A similar episode on 2026-11-25, on 2.0.3. About 80 minutes: 2 NEWNYM applied, then a few history reads. One read was refused with "Timed out after 0s waiting for another pithead operation" (the lock refusal in Tor auto-heal refinements deferred from #4095: circuit-completion gate, lock-refused history, 60 min disruptive spacing, KVM drop-cells leg #4280, verified). No ping failures were recorded then. Inferred: heal activity is not new in 2.0.4.
    • Ping timeouts. 50 tor_socks timeout rows (34 ConnectTimeout, 12 ReadTimeout, 4 Timeout). 40 fall between 06:05 and 07:42 on 2026-11-26, none during the first burst. The other 10 are spread over the next 31 h, and 5 of them follow a later reboot.

    What it shows: after a rejected NEWNYM the healer kept reading history and sent no repeat NEWNYM, and Tor was healthy again without action by the owner.

    What it does not show: that the tor-recover or restart rungs work on prod, what each history read returned, or the cause. The bundle has no Tor container log for the window, so the cause is unknown. Still open from #4045's criteria: the trigger, the fault-injection proof, the non-Tor alert path and Tor state captured during a failure. The owner's prod check waits on release gate #4302. Residuals sit in #4280 (lock refusal) and #4261 (onion-only or stale-consensus outages). Not affected by #4572: 2.0.4 has no guard-rotation action.

  15. pithead-architect commented on Nov 27, 2026

    @pithead-architect

    Moving this to v2.0.5. The fix shipped in 2.0.4, and the production evidence above shows Tor recovered without the owner's action. The remaining criteria are still open, so this stays open until they are proven: the trigger, the fault-injection proof, the non-Tor alert path, and Tor state captured during a failure. Release gate #4302 is closed with v2.0.4 published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracker

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions