Skip to content

Fix macOS nightly Playwright leg timing out at webServer startup - #14941

Merged
cderv merged 2 commits into
mainfrom
fix/macos-binary-playwright-webserver-timeout
Sep 23, 2026
Merged

cderv merged 2 commits into
mainfrom
fix/macos-binary-playwright-webserver-timeout

Conversation

@cderv

@cderv cderv commented Sep 23, 2026

Copy link
Copy Markdown
Member

When the built-binary nightly leg runs Playwright tests on macOS, the python -m http.server webServer step times out after 60s and the leg fails, every run since it was added.

Root Cause

macOS GitHub runners boot with an unresolvable <id>.local hostname (actions/runner-images#14568). CPython's http.server calls socket.getfqdn() between binding and listening; with no --bind, it resolves the dual-stack wildcard address first, and the reverse lookup on that address measured twice as slow as on 127.0.0.1 — long enough to run past Playwright's webServer timeout. The server sits bound but not listening the whole time.

Fix

Binds the server to 127.0.0.1 (matching the URL Playwright already probes) and raises its webServer timeout to 120s as a safety margin. Also gives macOS runners a resolvable hostname so any other process doing its own hostname lookup doesn't hit the same stall.

While in this workflow, also scoped test-smokes-built.yml's workflow_run trigger to main (manual dispatches from other branches were fanning out the full suite across three OSes) and collapsed the hand-copied build/nightly/release mode ternary into a single resolve-mode job.

macOS GitHub runners boot with a `<id>.local` hostname that the runner
itself cannot resolve, so any process looking up its own hostname stalls
about 35s while mDNS gives up (actions/runner-images#14568). Python's
http.server hits this in HTTPServer.server_bind via socket.getfqdn(),
before it starts listening: measured 35s for 127.0.0.1 and 70s for the
dual-stack default, past Playwright's 60s webServer timeout. That is why
the nightly macOS Playwright leg has failed on every run.

An /etc/hosts entry alone does not help because `.local` names go to
mDNS; renaming to a plain HostName with a matching hosts entry is the
workaround reported upstream (0.04s lookups).
With no --bind, http.server resolves the dual-stack wildcard address
and does its getfqdn() reverse lookup on it, which measured twice as
slow as 127.0.0.1 on macOS runners. Binding to 127.0.0.1 matches the
url Playwright already probes and keeps the server off other
interfaces. The 120s timeout keeps the leg from failing outright if a
runner image regresses on hostname resolution again.
@posit-snyk-bot

posit-snyk-bot commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 66ab95f into main Sep 23, 2026
84 of 85 checks passed
@cderv
cderv deleted the fix/macos-binary-playwright-webserver-timeout branch September 23, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants