Skip to content

fix(e2e): wait for local wheel server to be ready before proceeding#925

Merged
mergify[bot] merged 2 commits intopython-wheel-build:mainfrom
LalatenduMohanty:fix-wheel-server-readiness
Feb 25, 2026
Merged

fix(e2e): wait for local wheel server to be ready before proceeding#925
mergify[bot] merged 2 commits intopython-wheel-build:mainfrom
LalatenduMohanty:fix-wheel-server-readiness

Conversation

@LalatenduMohanty
Copy link
Member

@LalatenduMohanty LalatenduMohanty commented Feb 25, 2026

On macOS, python3 -m http.server without --bind calls getaddrinfo() which returns AF_INET6 first, causing the server to bind to :: (IPv6). Since macOS defaults IPV6_V6ONLY=1, the IPv6 socket does not accept
IPv4 connections, so uv connecting to 127.0.0.1 gets ETIMEDOUT.

Also the start_local_wheel_server function launches python3 http.server in the background but returns immediately. On macOS CI runners the server can take a moment to start listening, causing uv to fail with TCP connect timeouts. Add a readiness poll loop that waits up to 15 seconds for the server to respond before returning.

Closes: #924

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner February 25, 2026 00:25
@mergify mergify bot added the ci label Feb 25, 2026
@EmilienM EmilienM requested review from dhellmann and tiran February 25, 2026 00:48
The start_local_wheel_server function launches python3 http.server in
the background but returns immediately. On macOS CI runners the server
can take a moment to start listening, causing uv to fail with TCP
connect timeouts. Add a readiness poll loop that waits up to 15 seconds
for the server to respond before returning.

Closes: python-wheel-build#924
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
On macOS, python3 -m http.server without --bind calls getaddrinfo()
which returns AF_INET6 first, causing the server to bind to :: (IPv6).
Since macOS defaults IPV6_V6ONLY=1, the IPv6 socket does not accept
IPv4 connections, so uv connecting to 127.0.0.1 gets ETIMEDOUT.

Bind explicitly to 127.0.0.1 on macOS and 0.0.0.0 on Linux (where
podman containers need to reach the server via the host's routable IP).

Also replaces non-POSIX `which` with `command -v`.

Closes: python-wheel-build#924
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@LalatenduMohanty LalatenduMohanty force-pushed the fix-wheel-server-readiness branch from d3d1da4 to 2fb493c Compare February 25, 2026 02:02
@tiran
Copy link
Collaborator

tiran commented Feb 25, 2026

Question: Why are we using an external wheel server in tests? I have rewritten the builtin wheel server a while ago. It is now a full features HTTP server with asyncio, Starlette and uvicorn instead of the naive threaded http.server from stdlib.

@dhellmann
Copy link
Member

Question: Why are we using an external wheel server in tests? I have rewritten the builtin wheel server a while ago. It is now a full features HTTP server with asyncio, Starlette and uvicorn instead of the naive threaded http.server from stdlib.

Some of the tests need a separate server to exercise the option that we use downstream to point to an external cache server.

@mergify mergify bot merged commit eef0886 into python-wheel-build:main Feb 25, 2026
48 checks passed
@tiran
Copy link
Collaborator

tiran commented Feb 25, 2026

Some of the tests need a separate server to exercise the option that we use downstream to point to an external cache server.

Why are we not using fromager wheel-server to serve the wheels?

@dhellmann
Copy link
Member

Some of the tests need a separate server to exercise the option that we use downstream to point to an external cache server.

Why are we not using fromager wheel-server to serve the wheels?

Because the person who added that feature didn't rewrite the tests? :-)

LalatenduMohanty added a commit to LalatenduMohanty/fromager that referenced this pull request Feb 25, 2026
Replace python3 -m http.server with the builtin fromager wheel-server
(Starlette/uvicorn) and bind to 127.0.0.1 on all platforms. This is
safe because uv pip install always runs on the host without network
isolation. Eliminates platform-specific workarounds from PRs python-wheel-build#923/python-wheel-build#925.

Closes: python-wheel-build#927
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
LalatenduMohanty added a commit to LalatenduMohanty/fromager that referenced this pull request Feb 25, 2026
Replace python3 -m http.server with the builtin fromager wheel-server
(Starlette/uvicorn) and bind to 127.0.0.1 on all platforms. This is
safe because uv pip install always runs on the host without network
isolation. Eliminates platform-specific workarounds from PRs python-wheel-build#923/python-wheel-build#925.

Closes: python-wheel-build#927
Co-Authored-By: Claude <claude@anthropic.com>
Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(e2e): race condition in start_local_wheel_server causes flaky macOS CI failures

4 participants