fix(sync): AdaptiveWaitGroup counter racy#701
Merged
dwisiswant0 merged 1 commit intomainfrom Nov 15, 2025
Merged
Conversation
causing flaky tests. Reorder counter updates relative to semaphore ops to prevent race condition where `Current()` could temporarily exceed 2485582size+12485582. * `Add()`: inc counter before acquiring semaphore * `Done()`: dec counter before releasing semaphore This eliminates the race window where both `Add()` and `Done()` had pending counter updates, causing `TestThrottling` to fail in CI with `Current()` reaching 6-7 instead of expected max. of 5 (size=4). Signed-off-by: Dwi Siswanto <git@dw1.io>
Member
Author
|
@coderabbitai create an issue for this. |
Mzack9999
approved these changes
Nov 14, 2025
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.
fix(sync):
AdaptiveWaitGroupcounter racycausing flaky tests.
Reorder counter updates relative to semaphore$$size+1$$ .
ops to prevent race condition where
Current()could temporarily exceed
Add(): inc counter before acquiring semaphoreDone(): dec counter before releasing semaphoreThis eliminates the race window where both
Add()and
Done()had pending counter updates, causingTestThrottlingto fail in CI (#700) withCurrent()reaching 6-7 instead of expected max. of 5
(size=4).