[fix][test] Fix flaky ConnectionTimeoutTest by correcting latch count#25320
Open
merlimat wants to merge 1 commit intoapache:masterfrom
Open
[fix][test] Fix flaky ConnectionTimeoutTest by correcting latch count#25320merlimat wants to merge 1 commit intoapache:masterfrom
merlimat wants to merge 1 commit intoapache:masterfrom
Conversation
The CountDownLatch was initialized with `backlogSize + 1` but only `backlogSize` connections could succeed (the extra one hangs because the server backlog is full). This meant the latch never reached zero, causing the test to hang until the 5-minute timeout. Changed the latch count to `backlogSize` and added logging to help diagnose future issues.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #25320 +/- ##
============================================
- Coverage 72.73% 72.70% -0.03%
+ Complexity 34671 33843 -828
============================================
Files 1967 1954 -13
Lines 156326 154715 -1611
Branches 17812 17704 -108
============================================
- Hits 113697 112487 -1210
+ Misses 33552 33176 -376
+ Partials 9077 9052 -25
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
merlimat
added a commit
to merlimat/pulsar
that referenced
this pull request
Mar 14, 2026
Cherry-pick of apache#25320. The latch count was backlogSize+1 but only backlogSize connections can succeed, leaving the latch never reaching zero and the test relying on timing.
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.
Summary
ConnectionTimeoutTest.testLowTimeoutwhich was flaky due to incorrectCountDownLatchcountbacklogSize + 1but onlybacklogSizeconnections could succeed (the extra connection hangs because the server backlog is full), so the latch never reached zerobacklogSizeso the test proceeds once all possible connections are establishedTest plan
ConnectionTimeoutTest.testLowTimeout— should complete in seconds instead of timing out after 5 minutesDocumentation
doc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository:
This change is the fix for #15068 regression