fix(flowcontrol): map pre-admission TTL/cancel to eviction statuses i… - #2162
Open
LukeAVanDrie wants to merge 3 commits into
Open
fix(flowcontrol): map pre-admission TTL/cancel to eviction statuses i…#2162LukeAVanDrie wants to merge 3 commits into
LukeAVanDrie wants to merge 3 commits into
Conversation
…nstead of 500 A TTL expiry or client disconnect before an item reaches a queue (buffered in the enqueue channel, blocked in SubmitOrBlock, or racing managedQueue.Add) finalizes as QueueOutcomeRejectedOther, which the translator mapped to 500. Once the item is queued, the same event maps to 503 with a dropped-reason header. These pre-admission windows are widest under overload, so a saturation stall with TTL expiries showed up as a spike of 500s that was really backpressure. The translator now recognizes ErrTTLExpired and ErrContextCancelled in the RejectedOther/EvictedOther arm (after the shutdown check, which keeps precedence) and delegates to the matching eviction mapping, so the two paths cannot drift apart. The same branches cover EvictedOther for symmetry; nothing currently emits it with these sentinels. Separately, tryDistribution finalized a ManagedQueue lookup failure for a leased flow as QueueOutcomeRejectedCapacity, reporting an internal invariant violation as 429 with the Saturated header. It now finalizes as RejectedOther: a 500 with no saturation header. This also keeps the RejectedCapacity metric label to genuine capacity rejections. The registry error is flattened with %v because wrapping it would let ErrPriorityBandNotFound flow back through the connection closure and trip the priority-0 fallback in withConnectionWithFallback. Fixes llm-d#2097 Part of llm-d#1187 Signed-off-by: Luke Van Drie <lukevandrie@google.com>
LukeAVanDrie
force-pushed
the
fix/fc-preadmission-outcome-mapping
branch
from
July 24, 2026 06:40
b62ff61 to
03f0d26
Compare
Contributor
Author
|
I would like to hold this until #2047 is merged upon which I will make the updates mentioned in the PR description. |
LukeAVanDrie
marked this pull request as ready for review
July 24, 2026 06:44
This was referenced Jul 24, 2026
Collaborator
merged now |
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 type of PR is this?
/kind bug
What this PR does / why we need it:
Two outcome-mapping fixes in flow control admission.
A TTL expiry or client disconnect that fires before an item reaches a queue (buffered in the enqueue channel, blocked in submission, or racing
managedQueue.Add) finalizes asQueueOutcomeRejectedOther, whichtranslateFlowControlOutcomemapped to 500. Once the item is queued, the same event maps to 503 with a dropped-reason header. These pre-admission windows are widest under overload, so a saturation stall with TTL expiries showed up as a spike of 500s that was really backpressure.The translator now recognizes
ErrTTLExpiredandErrContextCancelledin theRejectedOther/EvictedOtherarm (after the shutdown check, which keeps precedence) and delegates to the matching eviction mapping, so the two paths cannot drift apart. The same branches coverEvictedOtherfor symmetry; nothing currently emits it with these sentinels.tryDistributionfinalized a ManagedQueue lookup failure for a leased flow asQueueOutcomeRejectedCapacity, reporting an internal invariant violation as 429 with theSaturatedheader. It now finalizes asRejectedOther: a 500 with no saturation header. This also keeps theRejectedCapacitylabel inflow_control_requests_totalto genuine capacity rejections. The registry error is flattened with%vbecause wrapping it would letErrPriorityBandNotFoundflow back through the connection closure and trip the priority-0 fallback inwithConnectionWithFallback.Coordination with #2047: it changes the same function (queued TTL eviction becomes 429 when the pool has endpoints). Whichever lands second threads the
ttlPoolEmptyparameter through the two delegating calls, and the pool-emptiness probe inAdmitshould also coverRejectedOther+ErrTTLExpiredso pre-admission TTL gets the same 429/503 split.Tests: new
TestTranslateFlowControlOutcomerows for pre-admission TTL and cancel on both outcomes, plus a shutdown-precedence row. The controller lookup-failure test now also asserts that registry sentinels do not leak into the finalized error and that no fallback retry happens. Both packages pass with-race.Which issue(s) this PR fixes:
Fixes #2097
Part of #1187.
Release note: