Skip to content

fix(utils): use separate IPv4/IPv6 lookups to avoid AI_ADDRCONFIG filtering#39914

Open
yury-s wants to merge 1 commit intomicrosoft:mainfrom
yury-s:fix-happyeyeballs-addrconfig
Open

fix(utils): use separate IPv4/IPv6 lookups to avoid AI_ADDRCONFIG filtering#39914
yury-s wants to merge 1 commit intomicrosoft:mainfrom
yury-s:fix-happyeyeballs-addrconfig

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented Mar 28, 2026

Summary

  • dns.lookup(host, { family: 0 }) passes AI_ADDRCONFIG to getaddrinfo(), which on macOS filters out loopback addresses for a protocol family when no non-loopback interface for that family is active (e.g. under VPN/WiFi changes)
  • This caused Happy Eyeballs to only try one address for localhost, failing intermittently when Chrome binds exclusively to ::1 (IPv6)
  • Fix: use parallel family: 4 and family: 6 lookups (which do not use AI_ADDRCONFIG) and merge results

Fixes microsoft/playwright-mcp#1482

…tering

When dns.lookup() is called with family: 0, Node.js passes AI_ADDRCONFIG
to getaddrinfo(), which on macOS filters out loopback addresses for a
protocol family if no non-loopback interface for that family is active.
This causes intermittent failures connecting to CDP endpoints on macOS
when Chrome binds only to ::1 (IPv6) — the lookup may return only
127.0.0.1, leaving ::1 untried.

Fix by doing separate family: 4 and family: 6 lookups (which do not use
AI_ADDRCONFIG) and merging the results, ensuring both IPv4 and IPv6
addresses are always included.

Fixes: microsoft/playwright-mcp#1482
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

1 failed
❌ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node20

3 flaky ⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-network-response.spec.ts:302 › should return body for prefetch script `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-request-gc.spec.ts:19 › should work `@firefox-ubuntu-22.04-node20`

39041 passed, 845 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [msedge] › mcp/files.spec.ts:106 › clicking on download link emits download @mcp-windows-latest

6279 passed, 350 skipped


Merge workflow run.

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.

CDP connection fails on macOS when Chrome binds IPv6-only (localhost resolution)

2 participants