Skip to content

Local DNS resolution sometimes fails #28292

Closed

Description

@dploeger
  • Version: v12.4.0 + v10.16.0 + v10.13.0
  • Platform: Darwin hosea 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
  • Subsystem: dns

When running multiple DNS queries in parallel using promises, the DNS resolution sometimes fails. We only noticed that on macOS so far.

Sample script:

const dns = require("dns");
const util = require("util");

const requests = [];
for (let i = 0; i < 1000; i++) {
  requests.push(
    util.promisify(
      dns.lookup
    )('waldbuehne-heessen.de')
  );
}
Promise
  .all(requests)
  .then(() => {
    console.log("ok");
  })
  .catch(error => {
    console.log(error);
    return error;
  });

Output (sometimes):

Error: getaddrinfo ENOTFOUND waldbuehne-heessen.de
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
  errno: 'ENOTFOUND',
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'waldbuehne-heessen.de'
}

During the execution, no DNS queries are sent out (tested using tcpdump), so only the local DNS cache seems to be involved.

Activity

  1. dploeger commented on Jun 19, 2019

    @dploeger
    Author

    We also wrote a GO program to check this and we couldn't reproduce the error there.

    Also, when using "google.com" the error doesn't occur.

    Very strange behaviour.

  2. sam-github commented on Jun 19, 2019

    @sam-github
    Contributor

    Can you reproduce when using the DNS promises API instead of util.promisify? https://nodejs.org/api/dns.html#dns_dns_promises_api

  3. mscdex commented on Jun 19, 2019

    @mscdex
    Contributor

    Does the Go program always send a DNS network request or does it utilize the same OS-level mechanism node/libuv does?

  4. dploeger commented on Jun 19, 2019

    @dploeger
    Author

    @sam-github I'll check that and keep you posted

    @mscdex There weren't any DNS requests (tested with tcpdump again) at least. I don't know any go-specifics however.

  5. dploeger commented on Jun 21, 2019

    @dploeger
    Author

    @sam-github Yes, same result with the direct promises API.

  6. bnoordhuis commented on Jun 24, 2019

    @bnoordhuis
    Member

    This issue is almost certainly a duplicate of #5436 (and see #26903 for context on why the error message is lacking.)

    I'm going to refer you to #5436 (and make sure you read through it all, it actually covers several issues) but let me know if there is reason to believe your issue is different and should be reopened.

  7. added
    dnsIssues and PRs related to the dns subsystem.
    duplicateIssues and PRs that are duplicates of other issues or PRs.
    on Jun 24, 2019
  8. dploeger commented on Jun 24, 2019

    @dploeger
    Author

    Right, I already saw #5436 and did try all workarounds but the family:4 one (I somehow skipped that and the comments on the issue are really branching out in multiple directions).
    So it basically boils down the system library (which isn't glibc on macos I presume) does switch randomly between 4 and 6 resolutions? The tested hosts did not have an AAAA record. So I guess, the successes were 4 resolutions while the fails were 6 resolutions.

    I'll comment that on #5436 as well.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.duplicateIssues and PRs that are duplicates of other issues or PRs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions