Repository navigation
fix(client): log the held range and re-queued bytes when a stolen-from lane faults - #2762
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The scheduler’s landed count includes replayed bytes after watermark healing, breaking the landed-plus-requeued invariant; it needs distinct-coverage accounting and a healed-then-faulted regression test.
1 open issue
What changed in this PR
This PR improves client diagnostics for lane faults after a steal, making the held range distinct from the original pick and the stolen tail.
Changes:
- Logs held and picked ranges alongside missing bytes re-queued after a fault.
- Adds the blob hash to both steal log variants.
- Adds regression coverage and documents the updated log fields.
| File | Description |
|---|---|
crates/client/src/source_set/tests.rs |
Updates range fixtures and checks fault log fields. |
crates/client/src/source_set.rs |
Extends LaneRange and logs held-range details. |
crates/client/src/scheduler/tests.rs |
Adds a steal-then-fault logging regression test. |
crates/client/src/scheduler.rs |
Preserves held-range requeue details and adds hashes to steal logs. |
CHANGELOG.md |
Documents the revised diagnostics and refusal-counting scope. |
Review effort: Balanced
| landed, | ||
| requeued, |
There was a problem hiding this comment.
Fixed in 254f91d.
unit.progress.verified goes up for every byte a leg reports. That includes bytes a leg delivers again after a heal, and an owed span that a gap reopens at the pick (rebills). So landed could count a byte twice, while requeued counts distinct bytes.
- The logged
landednow reads the store.landed_withincounts the bytes of the held range that were missing at the pick, minus the bytes still missing at the fault. A byte never leaves the store, so each byte counts once. The watchdog and the rate counter are unchanged. - The counter moves to a new
LaneRange::verifiedfield. It doesn't go away, because three decisions ask whether the provider sent any verified byte at all, not how many were new:- The timestamp-refusal guard (
source_set.rs). If the guard read the distinct count, a peer could re-deliver an owed span and then sendTIMESTAMP_SKEWto have its fault booked as clock skew. The guard test now sets onlyverified, withlanded: 0. - The covered-refusal start,
offset + verified. Its behaviour is unchanged. - The extra-stream fault level. Its behaviour is unchanged.
- The timestamp-refusal guard (
- Regression test:
a_leg_that_only_re_delivers_lands_nothing. Two readers fault at the same wire offset. The second re-delivers the first one's owed span and makes nothing new present, so its fault line must saylanded=0and re-queue what the first did. Withlandedread from the counter, it logslanded=245760and fails.- This drives the owed-span re-delivery, not a voucher heal. The scheduler's
ScriptedSourcehas no heal injection. Both paths re-deliver through the same counter, andlandedno longer reads that counter.
- This drives the owed-span re-delivery, not a voucher heal. The scheduler's
landed_counts_each_new_byte_of_the_held_range_oncepins the helper: a prefix that was present at the pick doesn't count, and the count is clipped to the held range.
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 4 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
…m lane faults A steal trims the victim's in-flight range to end at the split, but the lane-fault line printed the range the lane first picked. Read with "its remainder goes to the other lanes", the stolen tail looked re-queued. The Faulted arm of run_worker keeps the Requeued value and fills LaneRange from it: offset/len are the held range after any trim, requeued is the missing bytes of that range (Requeued.missing, which leaves out the owed span the run is extended to), and picked_offset/picked_len are the pick. With no byte held at the pick, landed + requeued == len. The covered-refusal count in SourceSet now spans the held range only; the stolen tail is the stealer's. Work stores the blob hash, and the steal line logs it at debug and info. Closes #2376 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lane-fault line logged `landed` from the unit's verified counter. A leg that delivers bytes the store already holds, after a heal or when it bills an owed span, adds them to that counter again, so `landed` could count a byte twice while `requeued` counts distinct bytes. `landed` now reads the store: the bytes of the held range that were missing at the pick, less the bytes still missing at the fault (`landed_within`). A byte never leaves the store, so it counts once. The counter moves to a new `LaneRange::verified` field. The decisions that ask whether the provider sent any verified byte keep reading it: the timestamp-refusal guard (a peer that re-delivers an owed span and then sends a clock code stays an ordinary source fault), the covered-refusal start, and the extra-stream fault level. The watchdog and the rate keep the counter, unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
254f91d to
905b9ad
Compare

What
A slow-victim steal trims the victim's in-flight range so that it ends at the split. The lane-fault WARN still printed the range the lane first picked. Read together with "its remainder goes to the other lanes", the line made the stolen tail look as if it went back to the queue and downloaded twice.
LaneRange.offset/lenare now the range the lane held when it faulted, after any steal. The new fields are:picked_offset/picked_len: the range as the lane picked it.requeued: the missing bytes of the held range that the other lanes still fetch.run_workerFaulted arm keeps theRequeuedvalue that it used to drop, and fillsLaneRangefrom it. The early owed-span fault re-queues nothing, so there picked == held andrequeued = 0.record_faultandlog_extra_faultlog the new fields. The message text does not change.Workstores the blob hash. The "stole the tail of a lane's missing remainder" line logshashat debug (covered suffix) and at info (slow victim).Closes #2376
Reviewer notes
requeuedisRequeued.missing, notRequeued.bytes.requeue_fromextends a run back to the paid frontier. The verified-but-unpaid span is already in the store, and only the lane that owes it bills it again, sobyteswould overstate what other lanes fetch.missingkeepslanded + requeued == len.Requeued.bytesand the Cancelled arm's debug line do not change.record_covered_refusalinsource_set.rs). The stolen tail is the stealer's, and a refusal of it counts on the stealer's lane. A refusal that arrives before any steal sees held == picked. A leg opened after a steal requests only the held range, because the steal lowersstop_at. So in practice the count changes only where it was wrong before.landedreads the store, not the unit's verified counter. It is the bytes of the held range that were missing at the pick, minus the bytes still missing at the fault (landed_within). A healed leg or an owed span re-delivers bytes the store already holds, and the counter counts them again. The counter is nowLaneRange::verified. It feeds the decisions that ask whether the provider sent any verified byte at all: the timestamp-refusal guard, the covered-refusal start and the extra-stream fault level. This addresses the Copilot review; see the thread.LaneRangeis#[doc(hidden)]and is not in the public-api snapshot.Verification
a_fault_after_a_steal_logs_the_range_the_lane_held. A slow source is stolen from and then faults. It checks that the steal line carrieshash=, thatoffset + len == split, thatlanded + requeued == len, thatpicked_offset == offset, and thatpicked_len > len.offset: r_start, len: r_lenfails the test ("the held range ends at the split"). LoggingRequeued.bytesfailslanded + requeued == len.a_leg_that_only_re_delivers_lands_nothing: a second leg that only re-delivers the first leg's owed span logslanded=0. Withlandedread from the counter, it logslanded=245760and the test fails.landed_counts_each_new_byte_of_the_held_range_once(the helper). Removing the clip to the held range fails it and the steal test.cargo nextest run -p decdn-client: 1214 passeddecdn-clientcargo clippy --workspace --all-targets --all-features -- -D warningsCARGO_BUILD_WARNINGS=deny cargo doc -p decdn-client --no-deps --document-private-items### Changedhash=on the debug arm. The same edit addshashto both arms.🤖 Generated with Claude Code