Skip to content

feat(mesh): request bounded single-path pings when observed RTT samples stall - #7919

Merged
CommaBot merged 1 commit into
mainfrom
feat/mesh-observe-ping
Nov 21, 2026
Merged

CommaBot merged 1 commit into
mainfrom
feat/mesh-observe-ping

Conversation

@CommaBot

@CommaBot CommaBot commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Sub-second streams (< 1 s interval) send or receive QUIC packets continuously. Those packets reset noq path keepalive timers without eliciting ACKs, which freezes same_path_rtt_samples and stalls Gate upgrades from Relay to Direct:

  • In asymmetric bidirectional streams where one endpoint switches to Direct first, the lagging endpoint sends pure MP_ACK packets on Direct and freezes next.sequence.
  • In pure unidirectional downstream streams, incoming authenticated packets reset PathKeepAlive on Relay and freeze current.sequence even while both endpoints remain on Relay.

This pull request updates iroh to zzj3720/iroh@9d1903ef653a41444afee1dafd3e6cb2fb3a87d2 (PathSelection::ping), updates all four noq-proto patches to zzj3720/noq@4b0448dd90709d9ffc2db1dd2b5887435157477e, and adds bounded demand-driven single-path probing in libs/mesh-transport/src/selection.rs:

  • Emit zero probes during Gate.cooldown, during direct_until holds, on stale paths (rx == 0 while tx >= 3 for 3 s), or when Gate tracking capacity is full.
  • Wait until the final second of the Gate observation window (t >= 4 s for 5 s Direct upgrades, t >= 2 s for 3 s Transit switches) before probing only the side whose sample.sequence has not advanced since gate.compared, and retry on the next tick if a probe reply is lost.
  • Key ProbeState by (connection, path) with a 60 s idle TTL across temporary same_path_rtt gaps and path generation changes, clearing in_flight on absence or generation bumps without refilling remaining or clearing backoff_until.
  • Bound each path state to 1 in-flight probe (2 s timeout), a 1 s minimum interval, and 6 probes before a 30 s backoff. After each 30 s backoff elapses without natural ACK progress, allow 1 single retry probe (<= 1 PING / 30 s) so pure unidirectional receivers never starve permanently after candidate churn.
  • Track a monotonic probe_seq_ceiling (+1 per emitted probe), migrate unanswered probe debt (new_sequence + unanswered) across same-generation RTT epoch resets while resetting sequence tracking on true new path generations, and require sample.sequence > probe_seq_ceiling to refill remaining = 6.
  • When Direct has Recovery.failures > 0 (Initial tier emits 0 probes) and stays selected for >= 3 min (STABLE_DIRECT_MS) with stalled RTT samples, share the same per-path budget and post-backoff single-retry token to confirm liveness, resetting failures only after sequence advances.

Verification

  • Deterministic explicit-clock unit tests:
    • cargo test --manifest-path libs/mesh-transport/Cargo.toml --lib --locked: 126 / 126 passed (17 / 17 selection::probe_tests, including window-tail lost-probe retry, post-backoff starvation recovery for Gate and Recovery, late probe reply rejection, same-generation RTT epoch-reset debt migration, temporary missing-RTT debt retention, generation churn burst bounding, and multi-peer isolation).
    • cargo test --manifest-path libs/mesh-transport/Cargo.toml --lib --locked --no-default-features: 113 / 113 passed.
    • client/core-ts/test/mesh.test.ts on main after #7927 hot-set merge: 120 / 120 passed.
  • Real Dual-Mac Gigabit LAN (Office-Host-2 192.168.1.17 <-> tokyo-mac-studio-0 192.168.1.124) & 5-minute steady-state measurements:
    • Asymmetric bidirectional 200 ms stream (550 ms / 750 ms stagger, initial Relay): switched to Direct (2.72-3.19 ms RTT) in ~5.0 s after dual-stack QNT candidate convergence (10.70-13.31 s from initial candidate appearance), emitting 0-1 Selector PINGs (1 on Direct when next.sequence stalled, 0 on Server) and 0 Selector PINGs afterwards.
    • Pure unidirectional downstream 200 ms stream from t = 0 (initial Relay): switched to Direct (1.82 ms RTT) in ~5.0 s after dual-stack candidate convergence (10.94 s total across two QNT candidate rounds), emitting 2 Selector PINGs (1 per candidate round on Relay, 0 on Server) and 0 Selector PINGs afterwards.
    • Pure unidirectional downstream 200 ms stream with 4 s candidate disqualification and recovery: switched to Direct (1.27-1.78 ms RTT) in 6.98-7.92 s after recovery, emitting 1-2 Selector PINGs on Client (0 on Server) and 0 Selector PINGs afterwards.
    • 5-minute (300 s) continuous 200 ms steady state after switching to Direct: 0 Selector PINGs on both endpoints (0 total txPings delta on pure unidirectional Direct).

@CommaBot
CommaBot force-pushed the feat/mesh-observe-ping branch from 8b444fc to 4773e81 Compare November 21, 2026 06:46
…es stall

Sub-second streams send or receive QUIC packets continuously. Those packets reset noq keepalive timers without eliciting ACKs, which freezes same_path_rtt_samples and blocks Gate upgrades to Direct.

Update iroh to zzj3720/iroh@9d1903ef and point all four noq-proto patches to zzj3720/noq@4b0448dd. Request bounded single-path pings only when Gate or penalized Recovery stalls on an observed path:

- Emit zero probes during cooldown, during direct_until holds, on stale paths, or when Gate capacity is full.
- Wait until the final second of the Gate observation window before probing only the stalled side, and retry on the next tick if a reply drops.
- Key probe state by connection and path across temporary RTT gaps and generation changes for 60 s.
- Allow six probes before a 30 s backoff, issue at most one retry per 30 s backoff until independent ACK progress arrives, and preserve unanswered probe debt across late replies and same-generation RTT epoch resets.
- Probe penalized Recovery after 3 minutes on Direct when RTT samples stall, and reset only after a new ACK.

Changelog: 改进:持续收发数据流时也能及时切换到更快的直连路径
Changelog-parts: station web android desktop
Co-authored-by: darksky <darksky@cue.surf>
@CommaBot
CommaBot force-pushed the feat/mesh-observe-ping branch from 4773e81 to ff9c65c Compare November 21, 2026 07:02
@CommaBot
CommaBot merged commit f39855b into main Nov 21, 2026
130 of 135 checks passed
@CommaBot
CommaBot deleted the feat/mesh-observe-ping branch November 21, 2026 07:17
CommaBot added a commit that referenced this pull request Nov 21, 2026
…clock now, index pace spend (#7952)

- front.rs STREAMS 5 -> 6 (and mesh.mbt says 6): a front is kept across updates and only replaced when STREAMS
  rises, so one started before iroh.probeRelay (#7567), the shell's unix backlog/retry and conn.hand skip (#7568)
  and the noq path-idle/RTT-stall fixes (#7869/#7899/#7919) kept running the old binary after updating.
- session_hub Hub::tw sets the threads store's now from the hub's clock before each write: insert_message stamps
  entries.at from the store's cached now, which nothing refreshed, so a person's message could carry an `at` hours
  off its ts.
- accounts_pool pace_view finds a profile's (hour, scope) entry through a map instead of scanning the list for each
  spend row (quadratic on GET /profiles/pace); output is byte-identical (NaN hours stay separate, -0 and 0 merge).

Tests: launcher test for a streams-5 front being replaced; harness op say.stampsNow with a node test (fails without
the fix: at = the store's start time); a pace_view golden recorded from the old implementation.

Co-authored-by: 3720 <zuozijian1994@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant