Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash in dns.lookup, ensure getaddrinfo() only returns IPv4-only or IPv6-only results when it should, normalize node:dns errors #12223

Merged
merged 6 commits into from
Jun 29, 2024

Conversation

Jarred-Sumner
Copy link
Collaborator

What does this PR do?

This does three things:

  1. Fixes a crash in dns.lookup
  2. On IPv6-only networks or IPv4-only networks, getaddrinfo() will now only return connectable addresses due to the
  3. Normalize DNS errors to better match Node. Node treats ENONAME, ENODATA as both ENOTFOUND.

Duplicates:

Not as confident this fixes these, but there's a high chance it does:

How did you verify your code works?

Re-enabled some tests, but that crash in CI should be fixed

@robobun
Copy link

robobun commented Jun 28, 2024

@Jarred-Sumner, your commit b29adb8 has 14 failures in #451:

  • test/js/bun/spawn/spawn-streaming-stdin.test.ts - 1 failing on 🪟 x64
  • test/js/bun/http/serve-body-leak.test.ts - 2 failing on 🪟 x64
  • test/integration/next-pages/test/next-build.test.ts - 1 failing on 🪟 x64
  • test/integration/next-pages/test/dev-server-ssr-100.test.ts - 1 failing on 🪟 x64
  • test/js/bun/udp/udp_socket.test.ts - timeout on 🍎 13 aarch64
  • test/cli/watch/watch.test.ts - 1 failing on 🪟 x64
  • test/js/bun/udp/dgram.test.ts - timeout on 🍎 13 aarch64
  • test/js/bun/dns/resolve-dns.test.ts - 3 failing on 🐧 20.04 x64-baseline
  • test/js/bun/dns/resolve-dns.test.ts - 3 failing on 🐧 20.04 x64
  • test/js/bun/dns/resolve-dns.test.ts - 3 failing on 🐧 20.04 aarch64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 12 x64-baseline
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 20.04 x64-baseline
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 22.04 x64-baseline
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 20.04 x64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 12 x64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 22.04 x64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 20.04 aarch64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 12 aarch64
  • test/js/bun/glob/scan.test.ts - 2 failing on 🐧 22.04 aarch64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 20.04 aarch64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 22.04 aarch64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 12 aarch64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 12 x64-baseline
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 22.04 x64-baseline
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 20.04 x64-baseline
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 22.04 x64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 12 x64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 20.04 x64
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 20.04 x64 (smoke)
  • test/js/third_party/grpc-js/test-retry.test.ts - timeout on 🐧 22.04 x64-baseline (smoke)
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 20.04 x64-baseline
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 12 x64-baseline
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 12 x64
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 20.04 x64
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 22.04 x64
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 22.04 x64-baseline
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 20.04 aarch64
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 12 aarch64
  • test/js/web/workers/worker.test.ts - 1 failing on 🐧 22.04 aarch64
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 12 x64-baseline
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 22.04 x64-baseline
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 20.04 x64-baseline
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 22.04 x64
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 12 x64
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 20.04 x64
  • test/js/node/worker_threads/worker_threads.test.ts - 1 failing on 🐧 12 aarch64 -smoke
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 20.04 x64-baseline
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 12 x64-baseline
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 12 x64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 20.04 x64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 22.04 x64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 22.04 x64-baseline
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🪟 x64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 20.04 aarch64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 12 aarch64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 22.04 aarch64
  • test/js/web/fetch/fetch-gzip.test.ts - 1 failing on 🐧 20.04 x64 (smoke)
  • test/bundler/bundler_edgecase.test.ts - segmentation fault on 🪟 x64
  • test/bundler/bundler_edgecase.test.ts - segmentation fault on 🪟 x64
  • test/bundler/bundler_edgecase.test.ts - segmentation fault on 🪟 x64
  • test/js/bun/dns/resolve-dns.test.ts Show resolved Hide resolved
    @@ -271,6 +271,10 @@ pub fn normalizeDNSName(name: []const u8, backend: *GetAddrInfo.Backend) []const
    } else if (strings.isIPV6Address(name)) {
    backend.* = .system;
    }
    // getaddrinfo() is inconsistent with ares_getaddrinfo() when using localhost
    Copy link
    Contributor

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    This doesn't really explain anything, what exactly is inconsistent?

    @Jarred-Sumner Jarred-Sumner merged commit 5f34387 into main Jun 29, 2024
    51 of 53 checks passed
    @Jarred-Sumner Jarred-Sumner deleted the jarred/fix-getaddrinfo-crash branch June 29, 2024 01:45
    Copy link
    Contributor

    @Jarred-Sumner, your commit has failing tests :(

    🪟💻 5 failing tests Windows x64 baseline

    • test/cli/install/registry/bun-install-registry.test.ts 2 failing
    • test/cli/install/registry/bun-install-windowsshim.test.ts code 1
    • test/js/node/child_process/child_process.test.ts 1 failing
    • test/js/web/fetch/fetch.test.ts 1 failing
    • test/js/web/fetch/fetch.tls.test.ts 1 failing

    🪟💻 4 failing tests Windows x64

    • test/cli/install/bun-install.test.ts 1 failing
    • test/cli/install/registry/bun-install-registry.test.ts 1 failing
    • test/cli/install/registry/bun-install-windowsshim.test.ts code 1
    • test/js/node/child_process/child_process.test.ts 1 failing

    View logs

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