Skip to content

Let the OS pick the test servers' TCP ports - #334

Merged
poissoncorp merged 1 commit into
ravendb:v7.2from
poissoncorp:fix-flaky-tcp-ports
Dec 2, 2026
Merged

poissoncorp merged 1 commit into
ravendb:v7.2from
poissoncorp:fix-flaky-tcp-ports

Conversation

@poissoncorp

Copy link
Copy Markdown
Contributor

Issue

None, test infrastructure only.

What changed

The secured subscription tests failed now and then on CI with queue.Empty timeouts.

The test servers listened for TCP on fixed ports 38881 and 38882, both inside Linux's ephemeral port range. An outgoing connection can already hold one of them when a server starts. The secured server was given localhost, which it binds on every address it resolves to, keeping the ones it could bind. With 127.0.0.1:38882 taken it listened on ::1 only, the IPv4 client got connection refused on every retry, and the tests timed out.

Both servers now use port 0 and report the port they got to clients, the same way RavenDB's own test servers run. The secured one binds 127.0.0.1 only, so it cannot end up reachable over IPv6 alone.

Reproduced on the 7.2 server image with 127.0.0.1:38882 held: the two secured tests failed before this change. After it, they and all 22 subscription tests pass with the port held, and pass with it free.

Checklist

  • Tests added or existing tests cover the change
  • Breaking change (explain above if checked)

The test servers listened for TCP on fixed ports 38881 and 38882. Both sit in
Linux's ephemeral port range, so an outgoing connection can already hold one
of them when a server starts. The secured server was given "localhost", which
it binds on every address it resolves to while keeping the ones it could
bind. With 127.0.0.1:38882 taken it listened on ::1 only, the IPv4 client got
connection refused on every retry, and the secured subscription tests timed
out.

Both servers now use port 0 and report the port they got to clients, the same
way RavenDB's own test servers run. The secured one binds 127.0.0.1 only, so
it cannot end up reachable over IPv6 alone.
@poissoncorp
poissoncorp merged commit 7432439 into ravendb:v7.2 Dec 2, 2026
5 checks passed
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