fix(router): make load accounting cancellation-safe - #200
Open
bvolpato wants to merge 2 commits into
Open
Conversation
3 tasks
bvolpato
force-pushed
the
bvolpato/cancellation-safe-load-accounting
branch
from
August 16, 2026 20:32
863c4af to
471a660
Compare
3 tasks
Author
|
Consolidation note: #215, #216, and #176 overlap the load-accounting work here. This PR's current head still needs two streaming boundaries addressed: the regular forwarding task must observe receiver closure while awaiting an upstream chunk, and PD decode load must survive response headers until the body finishes or is dropped. #215 has the receiver-closure handling, #216 removes health-driven resets and adds request-path cancellation coverage, and #176 tracks the PD response body lifetime. Combining these pieces with a headers-then-stall regression would be preferable to another competing load-accounting implementation. Load-counter cleanup alone does not establish backend generation abort or GPU drain. |
This was referenced Sep 3, 2026
Signed-off-by: bvolpato <brunocvcunha@gmail.com>
Signed-off-by: bvolpato <brunocvcunha@gmail.com>
bvolpato
force-pushed
the
bvolpato/cancellation-safe-load-accounting
branch
from
September 10, 2026 04:44
471a660 to
ce02d26
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.
Purpose
Cache-aware routing increments worker load before each typed request. Manual cleanup can miss cancellation paths, double-decrement some failures, and release streaming load before response body lifetime ends. Health checkers currently mask drift by resetting counters periodically, which can also erase valid load from long-running requests.
Use scoped load guards for regular and prefill/decode routing. Each request or phase now releases its counter exactly once when scope ends, including errors, retries, task cancellation, stream completion, and client disconnect. Remove periodic resets because counters now follow request lifetimes.
Endpoint registration remains separate in #199.
Test Plan
Test Result
cargo fmt --all -- --check: passed.cargo clippy --all-targets --all-features -- -A clippy::result_unit_err -A clippy::chunks_exact_to_as_chunks -A clippy::result_large_err -A clippy::for_kv_map -D warnings: passed. The four allowed lints are unrelated Rust 1.98 warnings in existing code.cargo test --all-features: passed, including 491 library tests, every integration suite, and 4 documentation tests; 1 documentation test was ignored.git diff --check: passed.Essential Elements of an Effective PR Description Checklist