Repository navigation
Description
Spun out of the multi-agent review on #1145.
Problem
After #1143, open_from_candidate spends two sequential full pull_timeout budgets on a single candidate:
.open_or_reuse_channel(provider_addr, deps.config.deposit_hint, deps.config.pull_timeout) // budget #1
...
tokio::time::timeout(deps.config.pull_timeout, open_progressive_upstream(...)) // budget #2But outer_pull_deadline is unchanged — MAX_PROVIDER_ATTEMPTS × per_candidate + PULL_THROUGH_OUTER_SLACK = 3 × 20s + 10s = 70s at defaults, while a single candidate can now cost 40s. Add discover + probe_and_rank and the loop can reach fewer than two candidates before the handler's outer timeout cancels the whole fetch — defeating MAX_PROVIDER_ATTEMPTS = 3.
Worked example: a candidate whose channel open lands slowly (19s, inside budget) and whose peer then stalls the handshake costs 39s, not 20s.
selection.rs's outer_pull_deadline doc — rewritten in #1145 — asserts the arithmetic still holds. It doesn't, for this case.
Not a regression
Before #1143, open_or_reuse_channel was fully unbounded, so one candidate could eat the entire outer deadline. This is strictly better; it just stops one notch short of the guarantee the doc claims.
Suggested fix
Either:
- budget the outer deadline at
MAX_PROVIDER_ATTEMPTS × 2 × per_candidate + slack; or - (better) make the per-candidate budget a deadline rather than two independent durations: pass an
Instantdown and derive each stage's remaining budget from it, sochannel_open + open ≤ per_candidateby construction.
The second removes the whole class of bug rather than re-tuning a constant, and would also let PullDeadlines be derived from one budget instead of two positionally-passed Durations.
Also worth folding in
a_wedged_channel_open_does_not_starve_the_candidate_loop uses only two candidates, so it cannot catch this. A three-candidate variant would.
Related
- fix: bound the requester's fetch loop, and classify what comes back (#1088, #1144, #1134, #1143) #1145, Unbounded open_or_reuse_channel: a wedged on-chain RPC starves the candidate fallback loop #1143, node: pull-through outer deadline equals the per-candidate stream timeout — multi-provider fallback is dead under timeout-shaped failures #859 (
PULL_THROUGH_OUTER_SLACK), Window-path node→node open has no per-candidate timeout: a wedged candidate starves the fallback loop #1141.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
fix(node): top up reused buyer channels + drop redundant progressive-…