Skip to content

fleet(gh_cache): serve_entry_point test flakes on probe-drop-rebind port race (blocks amd toplevel build) #11296

Closed

Description

@dezren39

Found during the 2026-11-17 amd toplevel build for the Dot SSH activation: /nix/store/yb1dxhwcp9l0si8jnqxfiz66qzahzjpn-fleet-0.1.0.drv failed its check phase —

test gh_cache::tests::serve_entry_point_stays_up_and_caches ... FAILED
fleet gh cache-serve: cannot bind '127.0.0.1:42201': Address already in use (os error 98)
test result: FAILED. 49 passed; 1 failed

Mechanism: the test (pkgs/fleet/crates/fleet/src/gh_cache.rs, serve_entry_point_stays_up_and_caches) picks a port by binding 127.0.0.1:0, reads the assigned port, DROPS the probe listener, then hands the address to serve() as a string to re-bind. That is a probe-drop-rebind race: any other process can claim the port in the window, and on this laptop (dozens of concurrent lane builds and test suites) the window gets hit — the probed port 42201 was taken before serve() bound it. The port was free again immediately after the failure, confirming a transient race rather than a persistent listener.

Fix directions: have serve() accept a pre-bound TcpListener (the way serve_on already does) so the test never releases the port, or retry the probe+bind on AddrInUse with a fresh probed port. The loopback sibling test in the same file already binds port 0 and keeps the listener — the entry-point test should get the same treatment without losing its coverage of the real serve() path (the task-17509 regression it guards).

Impact: flakes the amd toplevel build (fleet is in the system closure), which blocks system switches until a retry lands on a free port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions