{"action":"created","issue":{"url":"https://api.github.com/repos/joyent/node/issues/25338","labels_url":"https://api.github.com/repos/joyent/node/issues/25338/labels{/name}","comments_url":"https://api.github.com/repos/joyent/node/issues/25338/comments","events_url":"https://api.github.com/repos/joyent/node/issues/25338/events","html_url":"https://github.com/joyent/node/issues/25338","id":76933515,"number":25338,"title":"dns.lookup fails when offline on Windows","user":{"login":"seanpoulter","id":2585460,"avatar_url":"https://avatars.githubusercontent.com/u/2585460?v=3","gravatar_id":"","url":"https://api.github.com/users/seanpoulter","html_url":"https://github.com/seanpoulter","followers_url":"https://api.github.com/users/seanpoulter/followers","following_url":"https://api.github.com/users/seanpoulter/following{/other_user}","gists_url":"https://api.github.com/users/seanpoulter/gists{/gist_id}","starred_url":"https://api.github.com/users/seanpoulter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanpoulter/subscriptions","organizations_url":"https://api.github.com/users/seanpoulter/orgs","repos_url":"https://api.github.com/users/seanpoulter/repos","events_url":"https://api.github.com/users/seanpoulter/events{/privacy}","received_events_url":"https://api.github.com/users/seanpoulter/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-05-16T03:40:25Z","updated_at":"2015-06-05T15:12:06Z","closed_at":"2015-06-05T15:12:05Z","body":"From dns.js, `dns.lookup` for `\"localhost\"` fails, throwing an ENOENT error from getaddrinfo. It's reproducible with the following block:\r\n\r\n```JavaScript\r\nvar dns = require(\"dns\");\r\ndns.lookup(\"localhost\", {\"hints\":3072}, function(err, ip, addressType) {\r\n  console.log(err, ip, addressType);\r\n})\r\n```\r\n\r\nRunning it when connected produces the output:\r\n```\r\nnull '127.0.0.1' 4\r\n```\r\n\r\nbut without a network connection:\r\n```\r\n{ [Error: getaddrinfo ENOENT]\r\n  code: 'ENOENT',\r\n  errno: 'ENOENT',\r\n  syscall: 'getaddrinfo',\r\n  hostname: 'localhost' } undefined undefined\r\n```\r\n\r\nUnfortunately debugging even this simple block with `node debug <file>` fails trying to connect to port 5858:\r\n```\r\n>node debug troubleshoot-dns.js\r\n< Debugger listening on port 5858\r\nconnecting to port 5858.............There was an internal error in Node's debugger. Please report this bug.\r\ngetaddrinfo ENOENT\r\nError: getaddrinfo ENOENT\r\n    at Object.exports._errnoException (util.js:746:11)\r\n    at errnoException (dns.js:49:15)\r\n    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)\r\n```\r\n\r\nOne solution is to patch dns.js to replace `\"localhost\"` with `\"127.0.0.1\"` which produces the expected output, but I think the better solution is to fix the `getaddrinfo` calls."},"comment":{"url":"https://api.github.com/repos/joyent/node/issues/comments/109323708","html_url":"https://github.com/joyent/node/issues/25338#issuecomment-109323708","issue_url":"https://api.github.com/repos/joyent/node/issues/25338","id":109323708,"user":{"login":"jasnell","id":439929,"avatar_url":"https://avatars.githubusercontent.com/u/439929?v=3","gravatar_id":"","url":"https://api.github.com/users/jasnell","html_url":"https://github.com/jasnell","followers_url":"https://api.github.com/users/jasnell/followers","following_url":"https://api.github.com/users/jasnell/following{/other_user}","gists_url":"https://api.github.com/users/jasnell/gists{/gist_id}","starred_url":"https://api.github.com/users/jasnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasnell/subscriptions","organizations_url":"https://api.github.com/users/jasnell/orgs","repos_url":"https://api.github.com/users/jasnell/repos","events_url":"https://api.github.com/users/jasnell/events{/privacy}","received_events_url":"https://api.github.com/users/jasnell/received_events","type":"User","site_admin":false},"created_at":"2015-06-05T15:12:05Z","updated_at":"2015-06-05T15:12:05Z","body":"@seanpoulter @dnakamura ... did the other issue get opened? Closing this but want to make sure the other issue is not dropped."}}