Repository navigation
fix(client,node): keep an answered probe when the direct-path wait outruns the timeout - #2345
Conversation
… the timeout (#2329) probe_once waited up to 500 ms for hole punching to select a direct path, and the wait ran inside the caller's timeout. The node probes its upstream with a 500 ms PROBE_TIMEOUT, so a cold dial that answered on the relay timed out in the wait and lost its answer. When that peer was the only full source (bcl on the testnet), the node had no candidate and refused the client's pull-through request with NotFound. The timeout now bounds the connect and the exchange. The direct-path wait gets only what is left of it, and a probe that has its answer keeps the exchange RTT when the wait runs out. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused implementation matches the documented behavior and covers the regression and timeout boundaries.
Review effort: Balanced
Findings: None
What changed in this PR
Prevents completed probes from being discarded while awaiting direct-path selection.
Changes:
- Separates exchange timeout handling from the optional direct-path RTT wait.
- Adds paused-time regression tests and updates ADR 005.
| File | Description |
|---|---|
crates/client/src/probe.rs |
Preserves answered probes and tests timeout behavior. |
adr/005-protocol.md |
Documents the revised probe timeout semantics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Rust Rust / code-coverage/cargo-llvm-covThe overall line coverage in commit 4d0a9db in the Show a line coverage summary of the most impacted files.
Updated |
A probe that keeps its answer after the direct-path wait runs out reports
its exchange RTT, which can be the relay detour. probe_once now returns a
ProbeRtt { ms, direct }. The node skips the ADR 030 region-latency penalty
for an RTT with no direct path behind it, so an honest same-region peer
behind a distant relay is not scored as a region spoofer, and it logs the
relay case at debug. The CLI logs the flag beside each probe answer.
Review follow-ups: tests for the 500 ms grace cap, a direct RTT above the
exchange RTT, an answer at the deadline and the rate-limit sentinel;
docs for REGION_LATENCY_MAX_MS, PROBE_TIMEOUT, PROBE_SETTLE_AFTER_HOLDER
and the probe_once caller note; ADR 001 and ADR 005 wording.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The previous commit skipped the region-latency penalty when no direct path backed a probe RTT. The peer controls whether hole punching succeeds, so a region spoofer could refuse direct paths and never be penalized. The penalty applies to every probe RTT again; the debug lines carry `direct` so an operator can tell a relay reading from a direct one. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Testnet resultThe fleet and the CLI both ran
|
Summary
The non-holders in #2329 can fill the miss. fra1, nbg1, hel1 and lon1 all run node-to-node pull-through and found bcl through the DHT. They refused because their upstream probe of bcl timed out after bcl had already answered.
#2248 made
probe_oncewait up to 500 ms for hole punching to pick a direct path, and that wait ran inside the caller'stimeout. The node probes its upstream withPROBE_TIMEOUT= 500 ms. So a cold dial that answered on the relay timed out during the wait and lost its answer. If that peer was the only full source, the node had no candidate and refused withNotFound. That covers both the unloggedpull_leg_missrefusals and the coverage-gate refusals withcandidates=2(only partial holders left).Fix:
timeoutbounds only the connect and the exchange. The direct-path wait gets what is left of the timeout, capped at 500 ms. A probe that has its answer keeps the exchange RTT when the wait runs out.probe_oncereturnsProbeRtt { ms, direct }(public-api.snapregenerated).directis false when no direct path was selected in time, so the RTT can be the relay detour.direct, so an operator can tell the two apart. The CLI'sprobe answereddebug line carriesrtt_direct.Evidence (testnet, 2026-10-06, fleet on the 10-05 05:06 build)
cache_miss: hel1 ~16, fra1 2, lon1 2, nbg1 1. There were no load-shed, signer-cap, chain-stale or origin-denied refusals.260a5c42span (Tempo1f981e0f…) showsdht_lookup providers=1taking 334 ms. The refusal came ~650 ms later and was not logged.decdn_node_pull_unreachable_totalrose in the 08:47 minute on fra1 (2), nbg1 (2), hel1 (4) and lon1 (2), and on hel1 again at 09:00 and 09:05. A failed upstream probe scoresUnreachable.11e20da0@3288334336 example at the coverage gate withcandidates=2.Test plan
exchange_within: answered probe with no direct path (regression; fails withprobe timed out after 500 mson the old composition), the 500 ms grace cap under a 5 s budget, lower and higher direct RTTs, an answer exactly at the deadline, an exchange past the budget, and the rate-limit sentinel passing through. The cap and.mintests each fail under their mutation.cargo nextest run -p decdn-nodepasses (1617).cargo nextest run -p decdn-client -p decdn-clipasses (1480).probe_loopback,probe_warm_reconnectandnode_origin_pullpass (118).cargo clippy --workspace --all-targets --all-features -- -D warnings,cargo fmt --checkand the rustdoc gate pass.4d0a9db2, Whisper large-v3 re-pulled with--namespace 1(results in the comment below).Not in this PR
pull_unreachablebursts continue after the redeploy, the next lever is ADR 001'sPROBE_TIMEOUT.Closes #2329
🤖 Generated with Claude Code