Skip to content

bundle pull: cold-miss whole-blob request hits the buffered range tier; CLI 30s stall clock fires on multi-GB files #2060

Closed

Description

@yigitdot

Symptom

decdn bundle pull of a multi-GB model directory fails its two largest entries while 14 smaller ones succeed. Node logs show nothing.

failed: original/model.safetensors: upstream pull timed out after 30s
failed: model-00001-of-00002.safetensors: upstream stalled: no progress for 30s
pulled into /Users/yigit/openai-chunked (14 fetched, 0 linked, 0 skipped, 0 deduped, 2 failed)
downloaded 9.0 GB
Error: 2 entr(ies) failed to fetch

Root cause

Both messages are CLI-local timers in decdn-client-pull; the node never emits them and nothing goes on the wire.

  • PullTimeout — crates/client-pull/src/lib.rs:699-708, raised at :1668 (open stage: dial → StreamRequest → signed StreamResponse under tokio::time::timeout(open)) and at :2584 (first-byte floor, cumulative == 0).
  • PullStalled — lib.rs:996-1005, raised at :2586 (trailing 30 s window with fewer than min_throughput_bps × window = 122,880 raw QUIC bytes).
  • 30 s = --stall-timeout-ms default (crates/common/src/cli/fetch.rs:286), used for both the open bound and the streaming window (crates/cli/src/commands/bundle_pull.rs:1143-1147). CLI flag only; no config-file field.

On a cache miss the CLI's whole-blob request routes the node onto a buffered, un-timed, keepalive-less path:

  1. open_fetch_prelude (crates/cli/src/commands/fetch.rs:1944-1980) does a throwaway (byte_offset=0, byte_len=0) open just to read total_bytes, then drops it.
  2. drive opens the real leg with align_range(0, total, total) → fetch_len() == total_bytes → PeerSource::open sends byte_len = total_bytes (non-zero) — crates/client-pull/src/source.rs:344-349.
  3. Node crates/node/src/handlers/client/dispatch.rs:953: byte_len > 0 → try_range_pull_through (fill.rs:223, no tokio::time::timeout, unlike the other fill tiers) → pull_through_range → range_pull_attempt (crates/cache/src/engine.rs:3408-3463): downloads the entire blob + outboard into a Bytes, encode_verified_range into a second O(size) buffer, import_bao_bytes (O(size) disk write), protect_partial — and only then signs StreamResponse.
  4. The streaming two-leg path serve_via_backend_origin (dispatch.rs:993-1027, "time-to-first-byte does not wait for the whole blob to land") is gated on byte_offset == 0 && byte_len == 0. Only the throwaway open ever reaches it, and dropping that open cancels the node's fill (window.rs:738-742).
  5. crates/cache/src/origin/http.rs:688-691 documents the buffering assumption — the range span is "far below the whole-blob streaming threshold" — which is false when byte_len == total_bytes.
  6. cdn/client/v1 has no keepalive (ChunkData cannot be empty) and the CLI floor counts raw QUIC bytes, so a node busy buffering is indistinguishable from a dead one.

Files whose origin download + verify + import finish inside 30 s succeed; the largest cannot. A re-run after the node finishes filling in the background hits cache and succeeds, which is why it looks intermittent.

The PullStalled variant is the same shape (node had nothing to send for > 30 s after some bytes flowed); the exact leg is not pinned down — a partial-hit resume or a slow leg in the two-leg spine are the candidates. Confirm with -vv on the CLI and a node-side origin_range_pull / serve_stream span trace.

Why logs are clean

Nothing fails node-side: the fill is running as designed, the client disconnects, and the resulting stream end logs at debug (dispatch.rs:259-262). The CLI raise sites emit no tracing event, and the CLI installs no subscriber without -v (crates/cli/src/logging.rs). The only unconditional output is the stderr failed: {path}: {err} line.

Secondary defect

The range tier holds ~2× the requested span in node RAM (data + encoded). For a whole-blob request that is a multi-GB allocation ×2 — an OOM risk independent of the timeout.

Workaround

decdn bundle pull ... --stall-timeout-ms 600000

--timeout-ms defaults to 1 h and validate() requires it to exceed 2× the stall budget, so up to ~29 min is accepted.

Candidate fixes

  • A. CLI/client-pull — send byte_len = 0 when the leg covers the whole blob (fetch_start == 0 && fetch_end == total_bytes) so the node takes the two-leg streaming path. Smallest change; resumed tails (offset > 0) still hit the buffered tier.
  • B. Node — route bounded/resumed requests through the two-leg spine (the dispatch.rs:972-974 / :1099-1108 "not yet wired" case). Fixes resumes too; larger change.
  • C. Node — stream pull_through_range instead of buffering, and wrap the range tier in a timeout like the other tiers. Removes the OOM risk; TTFB still waits on download + verify unless combined with A or B.

A and C compose; B subsumes A.

🤖 Generated with Claude Code

Activity

  1. added
    kind:bug
    area:cli
    area:node
    on Sep 19, 2026
  2. yigitdot commented on Sep 19, 2026

    @yigitdot
    ContributorAuthor

    Scope notes for option B, from reading the spine: (1) it is mostly lifting the byte_offset == 0 && byte_len == 0 gates in dispatch.rs:993-996 / :1116-1117 — claim_fill, FillSession::starting_at, plan_serve and content_paid_frontier are already offset-aware, but nothing tests offset > 0 end-to-end; (2) routing every bounded request through the spine makes small ranges pay for a thread + runtime + fill session (window.rs:658-666), so either keep try_range_pull_through behind a span threshold or accept that overhead; (3) the CLI's throwaway (0,0) open plus the real (0,total) open will now both claim a spine session back-to-back — verify the last-out cancel → re-claim path (#1664) under that shape. Depends on the spine fixes in the linked issue (outboard re-fetch per draw, ~1 MiB draw granularity), otherwise B is an origin-egress regression for large files.

  3. moved this from Backlog to In progress in deCDNon Sep 19, 2026
  4. self-assigned this
    on Sep 19, 2026
  5. moved this from In progress to Done in deCDNon Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:cliarea:nodekind: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