Repository navigation
Description
Summary
iroh/noq 1.4.0 kills client pulls mid-transfer. 131f6684 holds the iroh family at 1.3.0 in Cargo.lock (the baseline ADR 000 records). This issue tracks lifting that hold.
The cause is a known upstream regression: quinn-rs/quinn#2809, fixed in quinn by quinn-rs/quinn#2814 (quinn-proto 0.11.18). noq 1.4.0 has the cap but not the fix. n0-computer/noq#828 ports the fix and is open.
What breaks
noq-proto 1.4.0 adds a per-stream cap on buffered chunks (src/connection/assembler.rs):
const MAX_CHUNKS: usize = 1024;
const COMPACT_THRESHOLD: usize = 2 * MAX_CHUNKS;
...
if over_allocation > threshold || self.data.len() > COMPACT_THRESHOLD {
self.defragment();
if self.data.len() > MAX_CHUNKS {
return Err(TooManyChunks);
}
}recv.rs maps it to TransportError::INTERNAL_ERROR, so the receiver (our client) closes the whole connection:
ConnectionClosed(ConnectionClose { error_code: INTERNAL_ERROR, frame_type: None, reason: b"too many gaps in stream buffer" })
1.3.0 has no such cap.
The cap counts retained buffers, not gaps. insert passes the whole packet payload length as allocation_size. A bulk-transfer packet carries one large STREAM frame, so the frame fills at least 83% of its allocation. try_mark_defragment then marks the buffer as defragmented, and defragment() never merges defragmented buffers. Each unread packet stays a separate buffer, even when the data is contiguous. About 2049 unread packets (~2.4 MiB at ~1200 B per frame) trip the cap with zero gaps.
Proof: an Assembler unit test on a copy of noq-proto 1.4.0.
- In-order, gap-free 1200 B frames in 1220 B packets, with no reads:
TooManyChunksat frame 2048, 2,458,800 bytes buffered. - The same frames, read after each insert: 100,000 frames, no error.
The trigger is a reader that falls ~2.4 MiB behind the sender. The cap is fixed and does not scale with the receive window. Our client advertises CLIENT_STREAM_RECEIVE_WINDOW = 64 MiB / CLIENT_RECEIVE_WINDOW = 128 MiB (crates/client/src/endpoint.rs), sized to the node's credit window (ADR 003 § Credit window). The node can legitimately run far more than 2.4 MiB ahead of the client's reads. The client reads frame by frame and does work between frames (bao verification, store writes, vouchers), so a short pause on a fast link is enough.
Effect on us
- The paid leg dies with
connection lostabout 12 MiB into a ~20 MiB pull. - The node has served ~2 MiB on credit past the paid frontier (
paid_wire_bytes=10485760, clientlanded=12533760). This matches a ~2.4 MiB unread backlog. - The client resumes from what landed, so that credit-window span is never paid.
anvil e2e (journeys)fails on the under-pay checks:cli_fetch_topup::fetch_of_blob_far_exceeding_deposit_settles_whole_wire_cost_once(3/3 retries,settled 18095 < wire floor 20083) andcli_bundle_pull_range_dedup::cli_bundle_pull_self_heals_a_lying_recipient_hint.
Bisection: the pre-bump lock passes; the pre-bump lock plus cargo update -p iroh (iroh, iroh-base, iroh-dns, iroh-relay, noq, noq-proto, noq-udp → 1.4.0) fails deterministically. tokio 1.54 alone does not trigger it.
The debug logs also show ~20 iroh multipath path::abandoned events (RemoteAbandoned { error_code: 62 }) in the second before the close. Reordering is not necessary to trip the cap, so these are probably not the cause.
Cost of the hold
noq-proto 1.3.0 predates the quinn fixes for RUSTSEC-2026-0185: a peer that sends small gapped STREAM or CRYPTO frames can make the assembler buffer an unbounded number of chunks. This applies to nodes (any client is a peer) and to clients (any node is a peer). cargo audit does not flag it because the crate is renamed. The hold trades broken pulls for this exposure.
Diagnose
cargo build -p decdn-node -p decdn-cli
DECDN_NODE_LOG='warn,noq_proto=debug,iroh=debug' \
cargo nextest run -p decdn-e2e --features anvil-e2e \
-E 'test(fetch_of_blob_far_exceeding_deposit_settles_whole_wire_cost_once)' --retries 0 --no-capture
# grep the output for `conn::closed`To do
- Push n0-computer/noq#828 (port of quinn node: cdn/client/v1 refusals cost an unthrottled signature and an origin HEAD per new hash #2694, fix(node): count a skipped mid-stream pool re-check and test the serve-miss PoolExhausted stop #2789, fix: box redeploy e2e futures, keep --json on an empty bundle pull, count stale mid-stream re-checks #2814) to a review and a release. Do not file a separate upstream issue.
- Keep the iroh family at 1.3.0 until a noq release contains the fix: box redeploy e2e futures, keep --json on an empty bundle pull, count stale mid-stream re-checks #2814 port. A blanket
cargo updateor a Dependabot bump re-breaks this, and onlyanvil e2e (journeys)catches it. - On the upstream release: bump the family, rerun journeys, record the new baseline in ADR 000. The bump also closes the RUSTSEC-2026-0185 exposure.
- Find which client read paths stall long enough to build a multi-MiB backlog. After the fix, the 64 MiB stream window still bounds the backlog, and a stalled reader holds that memory.
- Decide whether the client should pay for the credit-window bytes it landed on a leg that died. Today a dropped connection leaves them unpaid, which is the node's credit risk by design. The e2e floor assumes no transport fault.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsBacklog
Activity
fix(deps): hold noq-proto at 1.3 again, and keep Dependabot off the n…
fix(deps): hold noq-proto at 1.3 again, and keep Dependabot off the n…
fix(deps): restore the iroh/noq 1.3 hold and guard it in the lockfile (…