Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

0.11 dns.lookup throws exception on c-ares getaddrinfo error. #7731

Closed
chrisdickinson opened this issue Jun 5, 2014 · 0 comments
Closed

Comments

@chrisdickinson
Copy link

When calling dns.lookup with arguments that generate an error from cares_wrap.getaddrinfo, 0.11 throws an error, where previously it would return that error to the callback.

var assert = require('assert');
var cares = process.binding('cares_wrap');

var dns = require('dns');

// Stub `getaddrinfo` to *always* error.
cares.getaddrinfo = function() {
  return -1;
};

assert.doesNotThrow(function() {
  dns.lookup('example.com', function(error, result, addressType) {
    assert.ok(error);
  });
});

As of 8ae32a9 generates:

module.js:333
    throw err;
          ^
Error: Cannot find module '/Users/chris/projects/node/test/simple/test-dns-lookup-cb-error.js'
    at Function.Module._resolveFilename (module.js:331:15)
    at Function.Module._load (module.js:273:25)
    at Function.Module.runMain (module.js:490:10)
    at startup (node.js:124:16)
    at node.js:807:3

And as of v0.10.28 generates no output. This appears to be a regression from 0.10, introduced in this commit. PR incoming.

chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 5, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
that behavior.

Fixes nodejs#7731.
chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 5, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
that behavior.

Fixes nodejs#7731.
chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 5, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
that behavior.

Fixes nodejs#7731.
chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 5, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
that behavior.

Fixes nodejs#7731.
chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 6, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
the pre-12d0f0b behavior.

Fixes nodejs#7731.
chrisdickinson added a commit to chrisdickinson/node that referenced this issue Jun 6, 2014
Calling `dns.lookup` with arguments that generate an error from c-ares
previously sent those errors back to the callback. This commit restores
the pre-ca9eb71 behavior.

Fixes nodejs#7731.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant