Repository navigation
fix(client,cli): retry lane growth until a faulted remainder finds a stream - #2273
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The broadened growth policy conflicts with ADR 039’s canonical concurrency invariant and requires an ADR update.
Review effort: Balanced
Findings: 1
What changed in this PR
Improves bundle-pull recovery when lanes fault or stream permits are temporarily unavailable.
Changes:
- Retries lane growth and permits uncovered remainder reassignment.
- Releases lane leases earlier and reacquires permits for restarts.
- Adds focused scheduler tests and user-facing release notes.
| File | Description |
|---|---|
crates/client/src/streamer.rs |
Documents revised lease and widening behavior. |
crates/client/src/source_set.rs |
Adds restart backoff helpers. |
crates/client/src/scheduler.rs |
Implements growth retries, permit handling, reassignment, and tests. |
crates/cli/src/commands/bundle_pull.rs |
Documents bundle-pull permit ownership. |
CHANGELOG.md |
Records the recovery improvement. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…stream A faulted lane's remainder could wait minutes in bundle pull. Three gaps kept it from starting when capacity freed: - Growth was asked only at the fault. A `grow(1)` that found no free permit was never asked again, and a permit a sibling entry frees wakes nothing in the acquire loop. Every worker end and every landed build now ask again, and while a `grow` granted nothing and a range still waits, the loop asks again every GROWTH_RETRY (1 s). The info line "a faulted lane's remainder waits" logs only when the count changes. - Leases were released only when acquire returned, so a faulted or idle lane held its provider's permit from sibling entries for the whole fetch. A lane with a LaneWiden now releases its lease when its own worker ends. Its restart from the source set's lane cache takes its stream through `grow`, held as a ReleaseGrant, and backs off like a build that found every permit taken when none is free. A lane without a LaneWiden keeps its lease until the acquire returns. - growth_wanted offered only lanes that cover the range, so a remainder only the faulted lane covered had no candidate. It now applies the idle-worker rule: a busy lane not barred from pull-through may grow for a range no running lane covers, and its extra worker takes it through pick's uncovered branch. Refs #2230 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz
ADR 039 limited the additional stream to a busy source that covers a faulted source's remainder. The acquire now offers it for any queued range no idle source takes, lets any busy source not barred from pull-through take a range no running source covers, asks again as streams end and every second while a grant fails, and gives a lane's permit back when its first stream stops. State that, and keep the in-flight bound at most two streams per active source. The bundles appendix says a lane gives its permit back when it stops. Refs #2230 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz
…sals Review fixes for the lane growth retry: - A NotFound or size-ceiling refusal of an uncovered range on an extra stream counts toward barring the lane from pull-through (SourceSet::record_extra_refusal), without cooling the node. A busy partial holder that cannot pull through is no longer asked for an orphan range every second. - A lane whose node refuses its extra stream waits from GROWTH_RETRY, doubling to EXTRA_RETRY_CAP (30 s), before it is asked again; a verified byte on an extra stream ends the wait. The third refusal in a row logs at info. The retry clock takes the earliest of its triggers, and add_extra uses the lane's ended extra slot again, so Work stays bounded. - The waiting log names the ranges, logs when they change and every 30 s while they stay, says whether candidates refused or none existed, and speaks of a queued range, not a faulted lane's remainder. - A lane refused a stream to start again retries on a flat GROWTH_RETRY (SourceSet::start_retry), apart from the build backoff, and logs the first refusal at info. - The own worker's future holds a ReleaseLease guard, so the lease follows the worker's lifetime with no slot lookup; a restarting lane that still holds its lease starts on it. - ExtraPermits::release_one warns (and debug-asserts) on a release with none held; a closed semaphore warns. - ADR 039, the bundles appendix, the CHANGELOG and the docs state the partial-uncovered rule, the bar, the refusal backoff, the restart retry and the in-flight bound as the code has them. Tests: refused extras back off by doubling, uncovered refusals on extra streams bar the lane, a refused restart starts within a retry of a freed stream, a busy lane holds at most one extra grant, the restart cadence in SourceSet, extra slot reuse and the one-extra bound in Work. Refs #2230 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz
thiras
force-pushed
the
fix/2230-lane-growth-retry
branch
from
October 2, 2026 02:52
6c22d29 to
6548498
Compare
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.

What
A faulted lane's remainder in
decdn bundle pullnow starts as soon as a stream frees, instead of waiting behind a busy lane's whole range or for the dead node's next fault. This is #2230 item 3, building on #2231 (LaneWiden/growth_wanted).Refs #2230
Root cause
Three gaps in
crates/client/src/scheduler.rs:want_growthwas set only by an own-worker fault and cleared when the loop read it. Agrow(1)that found no free permit was never asked again. A permit that a sibling bundle entry gives back wakes nothing in this acquire's loop.ReleaseLeases::dropreleased every lane'sLaneLeasetogether. So a faulted or idle lane held its provider's stream permit from sibling entries for the whole fetch.growth_wantedoffered only lanes thatcoversthe segment. Once the faulted lane parks, a remainder that only it covered has no candidate, even though any unbarred lane could serve it by pull-through.Changes
Growth). The one exception is an extra-stream fault that its lane outlives (a refused extra), which arms that lane's backoff instead. When a pass leaves a range waiting after agrowgranted nothing, the loop addsGROWTH_RETRY(1 s) to itswakeand asks again then.LaneWidenreleases its lease when its own (non-extra) worker ends, through aReleaseLeaseguard in that worker's future (Hold::Own). A lane restarts from theSourceSetlane cache, not throughconnect, so a restart whose lease is no longer held takes its stream throughwiden.grow(1)and holds it as aReleaseGrant. If no permit is free, the start waits a flatGROWTH_RETRY(SourceSet::start_retry, separate from the build backoff) and logs the first refusal at info. A lane without aLaneWidenkeeps its lease until the acquire returns, as before.growth_wantedcandidate predicate is now(orphan && !barred(lane)) || covers(lane, seg), the same rule idle workers use. An extra worker'spickreaches the existing uncovered branch, andbarred(i)reads the lane's bar throughlane_of. ANotFoundor size-ceiling refusal of an uncovered range on an extra stream counts toward the pull-through bar (SourceSet::record_extra_refusal), without cooling the node.GROWTH_RETRYdoubling toEXTRA_RETRY_CAP(30 s); a verified byte on an extra stream clears it; the third refusal in a row logs at info.add_extrareuses the lane's ended extra slot, soWorkstays bounded.Reviewer notes
Growth/GrowthPass, the batch-start loop inacquire(restart grant), the worker-end arm (extra refusals), andHold/ReleaseLease.cli_sources.rslane_lease. That does not work here. Restarted lanes come fromSourceSet::cached_laneand never reachconnect/build. A rebuild would open a fresh lane, which adds a newFaceLaneHandleand a new pool-view entry. So the restart takes its permit through the lane's ownLaneWiden, which holds the same per-provider semaphore and never waits.LaneWidenkeeps its contract: onereleaseper granted stream.pubitem changed. Thedecdn-clientpublic-api snapshot passes unchanged.Verification
cargo fmt -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo nextest run -p decdn-client -p decdn-cli: 1367 passedRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-itemscargo nextest run -p decdn-client --features public-api-test --test public_api: passes, no snapshot changepre-commit run --files <changed files>CHANGELOG.mdentry added under FixedNew tests in
scheduler.rs. Each was checked to fail with its fix disabled:growth_is_asked_again_once_a_stream_frees:growfails at the fault, and a permit frees 300 ms later. The extra opens on the retry clock, before the dead node returns from its cooldown and faults again.a_remainder_only_the_faulted_lane_covered_goes_to_a_busy_lanes_extra: aWork-level test. A barred busy lane is not asked. An unbarred busy non-covering lane is asked, and its extra'spickreturns the remainder withuncovered = true. A barred lane's extra takes nothing.a_lanes_lease_is_released_when_its_own_worker_ends: the lease drops while the fetch still runs. The lane restarts on a granted stream, and every grant comes back.a_node_refusing_every_extra_stream_is_asked_less_often: extra opens at 0, 1, 3, 7, 15 s; each wait doubles.extra_stream_refusals_of_an_uncovered_range_bar_the_lane: a busy partial holder refusing an orphan block withNotFoundis asked at mostABSENT_AFTER_NOT_FOUNDtimes (6 times in 50 s without the fix).a_lane_refused_a_stream_starts_again_once_one_frees: a restart with no free permit starts within oneGROWTH_RETRYof a sibling freeing one; asks stay about one per second; grants balance. Plussource_set::a_lane_refused_a_stream_waits_a_flat_retry.a_busy_lane_runs_at_most_one_extra_stream: with a hook that would grant 3, peak held grants stay at 1. TheWorktest also checks the one-extra bound and extra slot reuse.every_lease_is_released_when_acquire_returnsis unchanged in behavior. Its doc now says it covers lanes without aLaneWiden.Still to do after merge (from the plan): a live
bundle pullrun, compared with the 497–659 s baseline.🤖 Generated with Claude Code
https://claude.ai/code/session_01NHKbG6Jm75vFMLTNqK8ppz