Skip to content

Window-path node→node open has no per-candidate timeout: a wedged candidate starves the fallback loop #1141

Closed

Description

@thiras

Found while implementing #1129.

Problem

The buffered node→node path bounds each candidate with deps.config.pull_timeout: pull_from_candidate passes it into stream_fetch_tracked (crates/node/src/node_origin.rs:822), which converts an expiry into a typed PullTimeout and advances to the next ranked candidate.

The window-paced path (#856) does not. open_from_candidate calls open_progressive_upstream with no timeout at all (node_origin.rs:296-307), and client_pull::open_progressive_pull has no internal bound either (crates/client-pull/src/lib.rs:990). Its only bound is the outer deadline the serve path wraps around the whole discover → probe → rank → open sequence:

// crates/node/src/handlers/client.rs
let deadline = self.pull_through.get().copied().unwrap_or(WINDOW_PULL_FALLBACK_DEADLINE);
let (header, pull) = match tokio::time::timeout(deadline, origin.open_progressive_pull(hash)).await

That outer deadline is outer_pull_deadline(per_candidate) = MAX_PROVIDER_ATTEMPTS × pull_timeout + slack, and it is sized that way deliberately so the fallback loop can reach candidates #2..N. From crates/node/src/runtime/mod.rs:1070-1080:

an outer deadline equal to the per-candidate timeout would cancel the fetch the instant candidate #1 stalls, before the MAX_PROVIDER_ATTEMPTS fallback loop ever reaches candidates #2..N (#859). outer_pull_deadline budgets all N per-candidate budgets plus one-time discovery slack.

The window path inherits that outer budget with no inner bound, so it violates the invariant the comment describes.

Impact

A ranked-#1 candidate that accepts the QUIC connection and then goes quiet (blackholed peer, wedged serve loop) blocks inside open_progressive_upstream for the whole outer budget. Candidates #2/#3 are never opened, and the serve path signs a CacheMiss (NotFound) at a paying client — for a blob healthy peers hold and would have served. The buffered path cuts the staller at pull_timeout and delivers from the fallback.

Note the failure is cheapest to trigger by ranking first: a peer quoting a low rate ranks #1, so a cheap-and-wedged provider preferentially starves the loop.

Fix

Bound the open on the same per-candidate budget, and let the existing machinery classify it — classify_pull_failure (node_origin.rs:907) already special-cases PullTimeout (meters node_pull_timeout, and per #857 does not tar the peer, since our own deadline is not evidence the provider is bad), and open_from_candidates Err arm already routes through it.

Test

crates/node/tests/node_origin_pull.rs::node_origin_pull_falls_through_a_stalled_candidate already proves the contract for the buffered path, using spawn_a_stalling_server. The window-path counterpart is the same fixture against open_progressive_pull; it hangs to the outer budget on current code.

Fixed in the same PR as #1129.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions