Repository navigation
Skip e2e port slots whose proxy ports cannot be bound - #112
Conversation
|
Mira PR WalkthroughFixes a flaky e2e failure on macOS where a recently released port slot still had its proxy HTTPS port in TIME_WAIT, causing the daemon to fall back to 8443. Confidence: 4/5 ◉◉◉◉○ Safe to merge
2 files reviewed
|
A lab took the lowest free slot right after the previous lab in that slot released it. A connection that proxy closed first leaves its HTTPS port in TIME_WAIT, the daemon binds without SO_REUSEADDR, and the next lab's proxy fell back to 8443, failing with_runs_the_command_and_stops_the_daemon_it_spawned on macOS. The update tests also replaced the lab's user config, so their daemons ran on the default ports outside their slot.
8503424 to
c5ce8b9
Compare
with::with_runs_the_command_and_stops_the_daemon_it_spawnedfailed on main in run 41354847203 (e2e, macos-latest). Its daemon loggedPort 26190 is in use by another process; using 8443, soDEVLANES_PUBLIC_URL_APIcarried 8443 and the script exited 90.Cause
PortSlot::acquirealways takes the lowest free slot, so a test usually gets the slot the previous test on its nextest thread just released. In that run slot 1 (base 26100) went towith_keeps_the_exit_code_and_stops_the_lane, which curls through the proxy on 26190, then towith_never_ready_service_skips_the_command, then to the failing test about 5 s later. Slot 0 was held by the update test the whole time.The daemon binds its proxy ports without
SO_REUSEADDR(crates/proxy/src/listener.rs,bind), which is deliberate on macOS. A connection to the proxy that the proxy closed first leaves 26190 inTIME_WAIT(30 s on macOS, 60 s on Linux), and until then that bind fails withAddrInUse, so the proxy falls back to 8443. Only the HTTPS port warned; 26191 (HTTP, which saw no traffic) bound fine. A live process holding the slot would have taken both ports.The fallback is intended product behaviour, so the fix goes in the harness: before it hands out a slot,
PortSlot::acquirenow binds the slot's proxy ports on127.0.0.1and::1the way the daemon does, and moves on to the next slot if either is refused. OnlyAddrInUseandPermissionDeniedcount, so a host without IPv6 still works.Verification
TIME_WAITon slot 0's 26090 and then started a lab. Before the fix the lab took slot 0 and the daemon loggedPort 26090 is in use by another process; using 8443., the same warning as CI. With the fix the lab skipped slot 0 and the proxy bound 26190.cargo nextest run --profile e2epassed (54 including the scratch test, 4 skipped), andwith::,update::andproxy::passed 8 times in a row. That run also had anupdate.rsfix that Export the lane's project as DEVLANES_LANE_PROJECT #109 has since made on main, so this PR no longer includes it.cargo nextest run --profile e2epassed (59 passed, 4 skipped).cargo fmt --all --checkandcargo clippy -p devlanes-e2e --all-targets --all-features -- -D warningsare clean.I could not run macOS locally. On Linux, curl through the proxy closed with RST and left no
TIME_WAITin 300 tries, so I have not confirmed which side closed first on the macOS runner. The harness check covers any refusal on those ports either way.No change file: this only changes tests.
Written by OpenCode / Claude Opus 5.5