Skip to content

client-pull: blocking fsync on the tokio runtime stalls voucher sends; nodes drop every stream with 'proof read timed out after 10s' #2117

Closed

Description

@thiras

Symptom

A testnet decdn bundle pull of the gpt-oss bundle (manifest 994d470e…, ~27.5 GB without metal/, default --jobs 4 / --max-lane-streams 4) lost every large stream to fra1 at once. Four concurrent streams, all to the same lane, ended node-side within 4 s of each other:

fra1 17:26:54 client stream ended with error | proof read timed out after 10s: peer-side fault | len=2415919104 h=4e3024…
fra1 17:26:56 … proof read timed out after 10s … len=1409286144 h=0607ea…
fra1 17:26:56 … proof read timed out after 10s … len=27868174   h=059681…
fra1 17:26:58 … proof read timed out after 10s … len=1610612736 h=24823b…

The streams had run for about 26–30 s before this. The client saw frame read failed: frame I/O error: early eof and failed over. The same pattern hit lon1 and bcl at 17:28. The client-side WARN for lon1 shows it paying too late:

could not deliver an entry's ranges (no terminal signal after the voucher write failed;
recovery read failed: … early eof: write failed: … sending stopped by peer: error 0)

Node side is not at fault

The node asks for a proof only for bytes it has already sent. serve_leg.rs:222-258 (and delivery.rs ~315-360) adds a chunk to pending only after write_chunk_bufs has written it and unvouchered >= CHUNK_BYTES. commit_one_proof (crates/node/src/handlers/client/voucher.rs:166) is the only place with the 10 s VOUCHER_READ_TIMEOUT. A slow upstream (fra1 is a two-leg miss from bcl) parks the leg in producer.next_frame_chunks, which is in the deliver phase, where no proof timer runs. frame_target cuts frames at 1 MiB, so the chunk counts on both sides stay in step.

Suspected root cause: blocking disk I/O on the async runtime

The client pays from inside its read/decode loop (next_chunk → pay_one, driven by ingest_stream). If that loop stops, payment stops. ClientRangedStore::ingest_stream (crates/client-pull/src/ranged_store.rs:514) is an async fn, but it calls write_all_at (:560) and, every 4 MiB per stream, checkpoint (:572, :590) → data_file.sync_all() / outboard.data.sync_all() (:622-623). These run directly on the #[tokio::main] runtime (crates/cli/src/main.rs), not in spawn_blocking. With 4 jobs × up to 4 streams fsyncing sparse .partial files of 4–14 GB, fsyncs and page-cache writeback can block every worker thread. No stream to any provider can then pay for more than 10 s.

A second factor makes it worse: PoolLedger holds its issuance lock across each voucher write, bounded by VOUCHER_SEND_DEADLINE = 20s (crates/client-pull/src/ledger.rs:478). That is twice the node's VOUCHER_READ_TIMEOUT = 10s (crates/node/src/handlers/client/mod.rs:88). One blocked write therefore stalls every stream on that provider longer than the node will wait.

Not yet confirmed. The fsync stall is inferred from code plus timing. The last runtime cause has not been measured yet.

Confirm

  • Run the client with RUST_LOG=decdn_client_pull=trace and capture vmstat 1 / iostat -x 1 (dirty/writeback columns). Look for a gap of 10 s or more between reveal sends across all lanes.
  • Test: ingest_stream against a loopback node with an injected sync_all delay of 11 s or more should reproduce proof read timed out node-side.

Candidate fixes

  • A. Move write_all_at and checkpoint onto spawn_blocking, or a dedicated writer task, so disk I/O cannot stall the decode/pay loop.
  • B. Send payments from their own task, separate from ingest and decode.
  • C. Make VOUCHER_SEND_DEADLINE shorter than the node's VOUCHER_READ_TIMEOUT.

A or B is the fix. C only stops the client outliving the node.

🤖 Generated with Claude Code

Activity

  1. added
    kind:bug
    area:cli
    area:payments
    on Sep 22, 2026
  2. moved this from Backlog to In progress in deCDNon Sep 22, 2026
  3. moved this from In progress to Done in deCDNon Sep 22, 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:paymentskind: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