Skip to content

Test fixture servers read accepted sockets as non-blocking on macOS #184

Closed

Description

@rmcdaniel

Problem

Several in-process test servers bind a listener, call set_nonblocking(true) on it, and read from each accepted stream with a read timeout. On Linux an accepted socket does not inherit O_NONBLOCK; on macOS and the BSDs it does. On macOS, read() returns WouldBlock immediately, the fixture parses an empty request, and it answers 404 {"message":"not found"}.

The tests are green in hosted CI (Linux) but fail deterministically for anyone running cargo test on a Mac. On lab2 (macOS arm64, Rust 1.86.0) on main bee4465:

tests/fixtures/replay-regressions/storage-paused-cold-completion.json: rust-storage-paused-cold-completion worker replay failed: http 404 Not Found: {"message":"not found"}

Under load more cases fail the same way. The same pattern explains the "flaky" lib tests seen locally on #182 and #183 (worker_session heartbeat lease, long-poll capacity backpressure, runtime-upload discovery, query worker, cooperative shutdown, the cold-worker corpus cases).

Evidence

Adding let _ = stream.set_nonblocking(false); right after accept() in tests/replay_regression_corpus.rs takes that suite from 27/28 to 28/28 locally.

Files that set a non-blocking listener: tests/replay_regression_corpus.rs, tests/sticky_server.rs, tests/worker_registration.rs, src/lib.rs (test module) and src/tests/runtime_uploads.rs.

Done when

Every accepted test stream is explicitly set to blocking before it is read, and the full cargo test --all-targets --all-features passes on macOS arm64 as well as in hosted CI. Test-only change; no product behavior changes.

Activity

  1. added a commit that references this issue on Nov 13, 2026
    aa1ca95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:sdk-rustOwned by the sdk-rust repository agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions