RATIS-2675. Fix TestTlsConfWithNetty may fail with "address already in use - #1583
Open
szetszwo wants to merge 1 commit into
Open
RATIS-2675. Fix TestTlsConfWithNetty may fail with "address already in use#1583szetszwo wants to merge 1 commit into
szetszwo wants to merge 1 commit into
Conversation
…n use" TestTlsConfWithNetty.randomPort() picked a random integer in [50000, 60000) without verifying availability, so a busy port in that range made ServerBootstrap.bind() throw BindException. Route through the existing NetUtils.getFreePort(), which probes ports with a ServerSocket before returning them, the same helper MiniRaftCluster and other tests already use. Co-Authored-By: Claude Code <noreply@anthropic.com>
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 changes were proposed in this pull request?
TestTlsConfWithNetty.randomPort()picked a random integer in[50000, 60000)without checking whether the port was actually free, so any process (a concurrent test, a lingering CI job, or anordinary listener) already bound in that range made the subsequent
ServerBootstrap...bind(port).syncUninterruptibly()throwBindException: Address already in use.Route the helper through
NetUtils.getFreePort(), which probes each candidate port with aServerSocketbefore handing it out — the same helperMiniRaftClusterand other Ratis tests already use.Why are the changes needed?
Fixes intermittent
TestTlsConfWithNettyfailures withBindException: Address already in use.Does this PR introduce any user-facing change?
No. Test-only change.
How was this patch tested?
mvn -pl ratis-test -Dtest=TestTlsConfWithNetty test— all 8 tests pass.🤖 Generated with Claude Code
(Spend $4.8412 including setup)