Skip to content

node: a whole-blob header handshake makes a partial holder start a wasted upstream pull #2218

Closed

Description

@thiras

Summary

A node's whole-blob header handshake against a partial holder makes that holder start a full upstream miss pull, and the caller then abandons it.

  • Caller side. When the probe gives no predicted first leg, the pull leg opens (byte_offset 0, byte_len 0) to read the signed total_bytes, then aborts (crates/node/src/node_origin/pull_leg.rs:769-803).
  • Holder side. A partial holder cannot cover a whole-blob span, so the partial-serve gate (crates/node/src/handlers/client/dispatch.rs:736) falls through to the miss path. The holder runs a DHT lookup and opens an upstream pull before it answers.

Costs of each handshake:

  • about 1–1.5 s of dead time before the caller's real serve_miss_pull starts, the same gap two-leg proxy-warming miss still serves ~1.8 MB/s per stream after #2176 #2205 measured;
  • one wasted upstream open from the holder to the origin holder, which hits the seller's per-signer admission;
  • a failed stream on both upstream nodes (node_pull_through_client_abandoned, serve_stream_client_declined), which pollutes the failure counters and alerts.

Evidence (testnet, 2026-09-28, fleet on 8886c85c)

Entry 7cbb4846… (13.5 GiB consolidated.safetensors). bcl holds it whole; hel1 advertises it as a partial holder.

  • 10:07 UTC. lon1 serves a client range and opens a handshake to hel1 before each ~1 MiB sub-pull. hel1's serve_stream (trace 699409d1d4b2b00e0e0cf8f7a91894a7) runs byte_offset=0 byte_len=0 from peer=lon1. Then it runs dht_lookup for 945 ms, then open_progressive_pull to bcl for byte_len=1097728. lon1 drops it at +2.2 s with client-abandoned. That happened 20 times in 5 min. It accounts for all 20 of hel1's streams_failed, 18 of its 20 node_pull_attempts failing, and 19 of bcl's client_declined in the window.
  • lon1 side (trace 25b99fa1928371c8be9dd767f3f3ac89). The handshake open_progressive_pull to hel1 takes 996 ms, and only then does serve_miss_pull start its real legs to bcl.
  • 11:15:42 UTC. Right after a lon1 restart, the same pattern repeated 8 times within 2 s (hel1 traces b4f3238f…, 623db575…, 3a39bdee… and others). bcl logged a failed head stream to hel1 (proof 1 … connection lost, trace cf29062b…).

Options

  1. Skip the handshake when the probe already signed total_bytes. The probe reply carries it (decdn probe shows total_bytes for hel1). This needs no protocol change.
  2. Handshake on a range the candidate advertises as held. The candidate's coverage is already known, so the open is a partial hit on the holder.
  3. Let the holder answer a header-only request from its metadata without starting a fill. This changes the protocol, so it needs an ADR.

Option 1 or 2 fixes the caller without touching the wire.

Activity

  1. added
    kind:bug
    on Sep 28, 2026
  2. thiras commented on Sep 28, 2026

    @thiras
    ContributorAuthor

    Recurred on 2026-09-28 during a mistral bundle pull (client on ece78970, fleet on 8886c85c). This time fra1 was the caller.

    • fra1 opens byte_offset=0 byte_len=0 to hel1 (for example, trace d6646fc4804efb29f0cc8686aa352487 at 12:28:36, 1.88 s). hel1 then opens its own byte_len=1097728 head pull to bcl and drops it.
    • Tempo on bcl shows 7 sampled failed head streams to hel1 between 12:28:38 and 12:32:47. The traces are f191875a…, 95560c57…, 6662209e…, b6e2f986…, 5504394a…, 7b8a4494… and 8172dab8…. Each ends 0.5–1 s in with proof 1 of at most 8 for a 1048576-byte chunk (1048576 bytes owed, 0 more queued): proof stream read failed: connection lost. Tempo keeps ~25 % of spans (tempo holds ~25% of serve_stream spans, and the loss is silent #2210), so the real count is probably around 4× higher.

    Another cost, not listed above: the origin holder sends up to 1 MiB of unpaid data per handshake. "1048576 bytes owed" means bcl had committed a chunk to the leg and was waiting for its proof, which never arrived. Option 1 or 2 removes that too.

  3. thiras commented on Sep 28, 2026

    @thiras
    ContributorAuthor

    The CLI sends the same whole-blob handshake, and the handshakes nest across partial holders. Seen 2026-09-28 (CLI ece78970, client NodeId 5e55d0…):

    • 12:52:56.328: the CLI logs bundle pull: multi-source fetch of an entry failed (all sources failed; 2734861280 bytes unfetched); falling back to single-source failover for b32596…. The fallback's first open is byte_offset=0 byte_len=0 to fra1, which holds only part of that blob.
    • fra1 trace ef5db5928dd3b34bb6457f94b01859ba:
      • dht_lookup 314 ms;
      • then its own (0, 0) handshake to hel1, another partial holder, 1.6 s;
      • then an upstream_stream to bcl.
      • The CLI drops the leg at +4.9 s: closed by peer: upstream-pull-dropped.
    • The same happened at 12:34:52 (trace 9850675a2922a0b5884f53c40470eff5, 4.5 s).

    One header read from a CLI therefore costs ~5 s and two wasted fills: a CLI→fra1→hel1 chain, before any byte moves. Option 1 (use the probe's signed total_bytes) should cover the CLI's Downloader handshake too.

  4. alpergundogdu commented on Sep 30, 2026

    @alpergundogdu
    Contributor

    Fixed on both sides of the handshake:

    Together these remove the wasted upstream pull the handshake used to trigger on partial holders.

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

Metadata

Metadata

Assignees

Labels

kind:bug

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions