Fix macOS nightly Playwright leg timing out at webServer startup - #14941
Merged
Merged
Conversation
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.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the built-binary nightly leg runs Playwright tests on macOS, the
python -m http.serverwebServer 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>.localhostname (actions/runner-images#14568). CPython'shttp.servercallssocket.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 on127.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'sworkflow_runtrigger tomain(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 singleresolve-modejob.