Repository navigation
Description
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→ signedStreamResponseundertokio::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 thanmin_throughput_bps × window= 122,880 raw QUIC bytes).- 30 s =
--stall-timeout-msdefault (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:
open_fetch_prelude(crates/cli/src/commands/fetch.rs:1944-1980) does a throwaway(byte_offset=0, byte_len=0)open just to readtotal_bytes, then drops it.driveopens the real leg withalign_range(0, total, total)→fetch_len() == total_bytes→PeerSource::opensendsbyte_len = total_bytes(non-zero) —crates/client-pull/src/source.rs:344-349.- Node
crates/node/src/handlers/client/dispatch.rs:953:byte_len > 0→try_range_pull_through(fill.rs:223, notokio::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 aBytes,encode_verified_rangeinto a second O(size) buffer,import_bao_bytes(O(size) disk write),protect_partial— and only then signsStreamResponse. - 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 onbyte_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). crates/cache/src/origin/http.rs:688-691documents the buffering assumption — the range span is "far below the whole-blob streaming threshold" — which is false whenbyte_len == total_bytes.cdn/client/v1has no keepalive (ChunkDatacannot 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 = 0when 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_rangeinstead 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
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
yigitdot commentedon Sep 19, 2026
Scope notes for option B, from reading the spine: (1) it is mostly lifting the
byte_offset == 0 && byte_len == 0gates indispatch.rs:993-996/:1116-1117—claim_fill,FillSession::starting_at,plan_serveandcontent_paid_frontierare already offset-aware, but nothing testsoffset > 0end-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 keeptry_range_pull_throughbehind 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.feat(node): stream bounded and resumed cache-miss requests through th…