Repository navigation
fix(net): refresh live HTTP range bounds after async waits - #439
Open
dmytro-yemelianov wants to merge 1 commit into
Open
dmytro-yemelianov wants to merge 1 commit into
dmytro-yemelianov wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
A range can shrink while an HTTP fetch is parked in connect, header reading or rate limiting. The fetch can then request the obsolete tail, write/credit bytes beyond its live prefix, or attempt another read after that prefix is already complete.
This change rechecks the watermark after connect/redial and after the last await before each synchronous write. It skips an empty range, stops before an unnecessary body read, and keeps the original on-wire response bound for connection-pool framing. Rate limiting continues to account for consumed body bytes, including bytes subsequently discarded after a shrink. The scheduler policy is unchanged.
Five deterministic regressions cover reduced/empty ranges during connect and stale-pool redial, body bytes coalesced with delayed headers, a completed prefix followed by a failing read, and plain/chunked bodies paused in rate limiting. They also check credited byte offsets and pool eligibility. All five fail on upstream
73bfb796with the tests added and pass with this fix. Tokiotest-utilis explicit in the net crate's dev-dependencies so these tests also run independently of workspace feature unification.Validation on macOS arm64 / Rust 1.98.1:
cargo fmt --all -- --check— passed.cargo clippy --locked --all-targets --all-features -- -D warnings— passed.cargo test --locked --release --all-targets --all-features— passed.cargo test --locked --all-targets --all-features— stopped at one unchanged plugin timing test,exec::tests::unix::cancel_kills_the_child, whose 5-second bound expired (1,741 tests had passed, 5 ignored). The same candidate test binary passes that test alone in 0.13 s; clean upstream passes it alone in 0.11 s. Rechecking the entirehya-pluginlibrary passes all 147 tests. The original full-suite failure is retained; this is not a claim that the first debug run was clean.This PR addresses the reproduced async-boundary cases. It does not make a watermark load and file write atomic with respect to another thread, and it does not claim a general download-speed improvement. Developed with AI assistance; the upstream failures, corrected tests and validation commands were run locally.