Uh oh!
There was an error while loading. Please reload this page.
No blocking acquire on event loop - #2252
Merged
Merged
Conversation
Motivation: #2226 made the connection-permit acquire non-blocking on the event loop. CombinedConnectionSemaphore's non-blocking path takes the global permit first and then the per-host permit, releasing the global one if the per-host permit is unavailable. That releaseGlobal branch is the single place the non-blocking path can leak the global permit, yet it had no coverage: the existing combinedNonBlockingFailsFastWhenExhausted uses equal global and per-host limits (1, 1), so the acquire is rejected at the global gate and never reaches the per-host rejection where releaseGlobal runs. Modification: Add combinedNonBlockingReleasesGlobalPermitWhenPerHostExhausted using a wider global limit (2) than per-host (1). The non-blocking acquire passes the global gate, is rejected by the per-host limit (asserted as TooManyConnectionsPerHostException), and a follow-up non-blocking acquire for a different host must succeed; proving the global permit taken during the failed attempt was released rather than leaked. Result: The global-permit release path of the non-blocking combined acquire is now covered; a regression that leaked the global permit on per-host rejection would starve other hosts of the global permit and fail this test.
hyperxproforce-pushed
the
no-blocking-acquire-on-event-loop
branch
from
July 18, 2026 20:03
580626f to
6e89a8dCompareUh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Motivation:
#2226 made the connection-permit acquire non-blocking on the event loop. CombinedConnectionSemaphore's non-blocking path takes the global permit first and then the per-host permit, releasing the global one if the per-host permit is unavailable. That releaseGlobal branch is the single place the non-blocking path can leak the global permit, yet it had no coverage: the existing combinedNonBlockingFailsFastWhenExhausted uses equal global and per-host limits (1, 1), so the acquire is rejected at the global gate and never reaches the per-host rejection where releaseGlobal runs.
Modification:
Add combinedNonBlockingReleasesGlobalPermitWhenPerHostExhausted using a wider global limit (2) than per-host (1). The non-blocking acquire passes the global gate, is rejected by the per-host limit (asserted as TooManyConnectionsPerHostException), and a follow-up non-blocking acquire for a different host must succeed; proving the global permit taken during the failed attempt was released rather than leaked.
Result:
The global-permit release path of the non-blocking combined acquire is now covered; a regression that leaked the global permit on per-host rejection would starve other hosts of the global permit and fail this test.