FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0147 — The NetworkRoundTrip tests bind fixed TCP ports and collide when two runs overlap
ID 0147
Class TEST
Severity 1
Status ready

Models: —

Found: 2026-10-25 r2 Q6 (found when two features tested in parallel)

Evidence

tests/io/core/NetworkRoundTrip_test.cpp:24-29 makeEndpoint() starts at the fixed port 35500 (static std::atomic<int> nextPort{35500}) and takes 4 ports per test, so the second test binds 35504, and so on, in every process.

Effect

When two features run the io-network-roundtrip tests at the same time, the second process fails in zmq_bind (address in use).

Possible fix

Take a free port from the OS (bind to port 0 and read it back with ZMQ_LAST_ENDPOINT), or derive the base port from the process id.

Test that would prove it

Run two copies of the test binary at once; both must pass.

Risk

Low; test code only.