Skip to content

RATIS-2675. Fix TestTlsConfWithNetty may fail with "address already in use - #1583

Open
szetszwo wants to merge 1 commit into
apache:masterfrom
szetszwo:RATIS-2675
Open

RATIS-2675. Fix TestTlsConfWithNetty may fail with "address already in use#1583
szetszwo wants to merge 1 commit into
apache:masterfrom
szetszwo:RATIS-2675

Conversation

@szetszwo

@szetszwo szetszwo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

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 an
ordinary listener) already bound in that range made the subsequent ServerBootstrap...bind(port).syncUninterruptibly() throw BindException: Address already in use.

Route the helper through NetUtils.getFreePort(), which probes each candidate port with a ServerSocket before handing it out — the same helper MiniRaftCluster and other Ratis tests already use.

Why are the changes needed?

Fixes intermittent TestTlsConfWithNetty failures with BindException: 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)

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant