Repository navigation
Description
Three pre-existing sites on the cdn/client/v1 serve path turn a fault into something that looks like a successful empty result. They share one root cause and live in two files, so they are worth one pass rather than three.
Surfaced while reviewing #1828 (zero-copy ChunkData framing); none are caused by it, which is why they were kept off that branch and its follow-up.
1. crates/node/src/handlers/client/serve_encoder.rs:271
align_range(offset, end - offset, total)
.map_or_else(|_| ChunkRanges::empty(), |a| a.chunk_ranges().clone())An alignment error becomes an empty range. The encoder then emits zero bytes, the first next_frame_chunks returns Ok(None), and the serve loop writes StreamEnd with zero bytes delivered — telling the client a non-empty requested range was delivered in full. Unlogged and unmetered, and indistinguishable from the legitimate end == offset empty request the same expression handles.
2. crates/node/src/handlers/client/serve_encoder.rs:108
The same map_or_else to ChunkRanges::empty() in read_at. The comment argues it "fails cleanly rather than hanging", and it does — but the failure then surfaces as no live fill covers content [...]; every covering pull ended (serve_encoder.rs:154-156), blaming the pull leg for what is an alignment bug. Also unlogged.
3. crates/node/src/handlers/client/dispatch.rs:87 and :95
if let Err(e) = res {
tracing::debug!(error = %e, "client stream ended with error");
}Every error out of serve_stream — node-side bug and ordinary client disconnect alike — lands here at DEBUG, below the project's default RUST_LOG=info. This is what makes 1 and 2 invisible in the first place. The codebase flags the same anti-pattern elsewhere (node_origin/mod.rs:2745, dht/lookup.rs:175: "invisible at the project's default RUST_LOG=info").
Suggested shape
- Propagate the alignment error rather than substituting an empty range; an unalignable request is a bad request, not an empty one.
- Keep the legitimate
end == offsetcase explicitly separate from the error case, so the two stop sharing an expression. - Split the dispatch sink so a node-side fault logs at
error!while a peer disconnect stays atdebug!.
The follow-up to #1828 adds decdn_serve_frame_accounting_fault_total for the framing half of this problem; whatever lands here should sit alongside it rather than duplicate it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Projects
- StatusShow more project fieldsDone
Activity
fix(node): serve path converts faults into silent empty successes (#1833