Repository navigation
router: fix session boost grace hold being skipped - #1975
Open
Abhayanthk wants to merge 1 commit into
Open
Abhayanthk wants to merge 1 commit into
Abhayanthk wants to merge 1 commit into
Conversation
Signed-off-by: Abhayanth K <abhayanth2006@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/cc @YaoZengzeng @kube-gopher @LiZhenCheng9527 |
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.
What type of PR is this?
/kind bug
What this PR does / why we need it:
When a grace period is set, a slot freed by a finished request should be held for a same-session follow-up until the grace period ends. While testing
go test -raceon main, I sawTestSessionBoostQueue_GracePeriod_NoBoostArrivesfail with "Dequeue happened too early (before grace period)".The cause is a small timing window.
Releasefirst lowers the inflight count and then sends the release signal. The arrival path checks the release signal first and then reads the inflight count. If a release lands between those two reads, the arrival path sees no pending release but does see the free slot, so it admits a waiting request right away and the grace hold is skipped.The fix makes both sides read the same state.
Releasenow lowers the count and sends the signal under a newreleaseMu. The arrival path reads the release signal and the inflight count together under the same lock, and then admits only above the count it read. A slot freed after that read stays held for the grace path.I added a test case that frees a slot in the middle of the arrival handling. It fails on main and passes with the fix.
Which issue(s) this PR fixes:
None
Bug evidence (required for bug-related PRs):
TestSessionBoostQueue_GracePeriod_NoBoostArrivesfailed once in 3 full-raceruns of themake testpackages.Releasebetween the decrement and the signal, the same test fails 20 out of 20 times on main and 0 out of 20 with the fix.Special notes for your reviewer:
I used AI tools while working on this and verified everything myself.
Does this PR introduce a user-facing change?: