joule-moq-relay: the loop-of-relays test starts again on new ports when one it chose was taken #652
Loading…
Reference in a new issue
No description provided.
Delete branch "test/relay-loop-port-race"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
a_loop_of_relays(joule-moq-relaytests/cascade.rs) failed on the linux-arm64 leg of #640 withthe relay starts: "binding 127.0.0.1:34891: Address already in use (os error 98)". #640 changes no code here.Why. The test's three relays each dial the next, so all three ports are chosen with
free_port()before any relay listens.free_port()binds port 0, reads the port and lets it go. Another test running at the same time can bind that port in between, and the relay's start is then refused.The fix. A start refused for a port in use is tried again on three new ports, at most five times. The relays already started are shut down first. Any other refusal still fails the test, and what the test holds of the loop is unchanged:
relay_loopat the relay that would close it.Verified on a Linux build host:
tests/cascade.rs.🤖 Generated with Claude Code