Repository navigation
fix(node): serve path converts faults into silent empty successes (#1833) - #1837
Merged
Merged
Conversation
) Three sites on the cdn/client/v1 serve path turned a fault into something that looked like a successful empty result. CoherentFrameProducer::new now returns a Result and propagates an unalignable request (an offset past the blob end, or an end that overflows or exceeds the blob size) instead of flattening it to an empty range, which made the encoder emit zero bytes and the serve loop write StreamEnd for a non-empty request. The legitimate end == offset empty request stays separate and never errors. AwaitingDataReader::read_at maps an alignment error to an io::Error and propagates it instead of substituting an empty range, which surfaced as a misleading 'every covering pull ended' that blamed the pull leg for an alignment bug. The dispatch sink logged every serve_stream error at debug!, below the default RUST_LOG=info, so node-side faults were invisible. Add a ClientDisconnect marker for peer hang-ups (write I/O, proof read timeout, request read) and a ClientPaymentFault marker for buyer underpayment bails, and split the sink so a node-side fault logs at error! while a peer disconnect or client payment fault stays at debug!.
Coverage reportTotal: 82.01% (was 82.00%, ● 0.00%) — 68430/83445 lines
History
|
…view)
The dispatch sink split lands, but the marking around it was mis-tuned in
both directions and one class of node fault was still silenced.
- `BufferedProofReader::read` marks its peer arms — a reset stream, a
hang-up mid-frame, a malformed or undecodable frame, a non-proof
message. Those are the dominant client-abandon shapes and reached
`error!` unmarked. Its two bounds checks stay unmarked: node invariants.
- `VerifyStop::Bail` carries an `anyhow::Error` rather than a `String`, so
the two client-attributable stops mark themselves and the defensive
`RetrySignal` bail beside them does not. The `MAX_PROOFS_PER_CHUNK`
bails mark as `ClientPaymentFault`.
- The wire writes discriminate: `FrameError::TooLarge` and
`WriteError::{ClosedStream, ZeroRttRejected}` are this node's own bugs
and reach `error!`; the rest are the peer.
- `serve_leg` refuses an offset at or past the blob end instead of letting
the clamp fold it into the legitimate empty request.
- `ClientDisconnect` becomes `PeerFault`: it marks read timeouts and
malformed requests too, which "client disconnected" misnamed.
- One `log_stream_end` helper replaces the duplicated sink predicate,
logs `{e:#}`, and bumps `decdn_serve_stream_node_fault_total` so the
class is alertable rather than only greppable.
- The request-read marker rides as context so the inner chain survives.
Tests pin the classifier: marker survival under stacked context, oversized
frame vs write I/O, write-after-close vs peer stop, and a malformed proof
frame. `read`'s frame half splits into `take_buffered` to make the last one
reachable without a stream.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1833.
Three sites on the
cdn/client/v1serve path turned a fault into something that looked like a successful empty result. They shared one root cause and lived in two files, so they were worth one pass.1.
CoherentFrameProducer::new(serve_encoder.rs)align_rangeerrors were flattened toChunkRanges::empty(), so an unalignable request made the encoder emit zero bytes and the serve loop writeStreamEndfor a non-empty request — telling the client a non-empty range was delivered in full, unlogged and unmetered.newnow returnsanyhow::Result<Self>and propagates the alignment error. The legitimateend == offsetempty request stays separate and never errors.2.
AwaitingDataReader::read_at(serve_encoder.rs)The same
map_or_elsetoChunkRanges::empty()surfaced an alignment bug as the misleading "every covering pull ended" error, blaming the pull leg. It now maps the align error to anio::Errorand propagates it.3. dispatch sink (dispatch.rs)
Every error out of
serve_stream— node-side bug and ordinary client disconnect alike — landed atdebug!, below the project's defaultRUST_LOG=info, which is what made 1 and 2 invisible.Added a
ClientDisconnectmarker (peer hang-ups: write I/O, proof read timeout, request read) and aClientPaymentFaultmarker (buyer underpayment bails), and split the sink so a node-side fault logs aterror!while a peer disconnect or client payment fault stays atdebug!.The framing half of this problem was already handled by #1835 (
FrameAccountingFault+decdn_serve_frame_accounting_fault_total); this change sits alongside it rather than duplicating it.Verification
cargo build --workspace,cargo clippy --workspace,cargo fmt -- --checkclean.cargo nextest run -p decdn-node— 1044 tests pass, including a new testan_unalignable_request_errors_at_construction_not_as_an_empty_range.cargo nextest run -p decdn-e2e— 15 tests pass.