Repository navigation
Read test fixture sockets as blocking on macOS - #186
Conversation
On macOS and the BSDs an accepted socket inherits the listener's O_NONBLOCK, so the replay corpus, sticky proxy and lib mock worker servers read an empty request and answered 404. Set each accepted stream to blocking, with a write timeout so a client that stops reading cannot hang server shutdown. Test-only. Fixes #184 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
General interim review (Security unavailable; General didn't write this PR): exact head The change is test-only, 3 files and 11 added lines:
What it does: accepted fixture sockets are set to blocking, because on macOS/BSD they inherit the listener's O_NONBLOCK. They also get a write timeout, so a client that stops reading can't hang the shutdown join. Results: this explains the macOS-only flakes and 404s. The author reports the local full suite at 770/0, while main fails storage-paused-cold-completion 3/3 on lab2. CI: 17 pass, 2 input-selected skips. Merge state CLEAN. Merge only this SHA. |



Fixes #184. Test-only; no product code changes.
Problem
On macOS and the BSDs, an accepted socket inherits the listening socket's
O_NONBLOCK; on Linux it does not. Three in-process fixture servers set their listener non-blocking and then read each accepted stream. On a Macread()returnedWouldBlockimmediately, the fixture parsed an empty request, and it answered404 {"message":"not found"}. Hosted CI (Linux) was green, but the suite failed for anyone running it on macOS. These were the "flaky" local failures on #182 and #183.Change
Right after
accept(), each fixture sets the stream to blocking and gives it a write timeout:tests/replay_regression_corpus.rs, the replay fixture server;tests/sticky_server.rs, the sticky proxy (it already had a read timeout);src/lib.rs, the test-moduleMockWorkerServer(it already had a 200 ms read timeout).The write timeout matters. With blocking writes and no timeout,
runtime_upload_rejects_invalid_discovery_before_uploadhung forever: on its oversized-manifest case the client stops reading, the server blocks writing, and the server's shutdown join waits on it. Non-blocking writes used to fail fast there. The timeout keeps that behavior bounded.tests/worker_registration.rsand theruntime_uploadscredential-sink listener never read an accepted stream, so they're unchanged.Evidence (lab2, macOS arm64, Rust 1.86.0,
-j2)storage-paused-cold-completionfails 3/3 with the 404 above. A full run had 7–17 failures depending on load.cargo test --locked --no-fail-fast --all-targets --all-featuresrun passes 770 tests with 0 failures across 45 targets.runtime_upload_rejects_invalid_discovery_before_uploadruns over 60 s and has to be killed. With it,tests::runtime_uploadspasses 16/16 in about 4 s.🤖 Generated with Claude Code