-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
native-dns throwing when offline #8
Comments
Is there really no |
Yes, but it only exists when the wireless is turned on. OS X 10.9. Works fine when on.
|
Reproduced it on 10.10 too.
Definately looks like a bug in |
I guess we can just try/catch it for now. |
That is a pretty show-stopping bug on OSX. We could try catching the error and return an offline status. |
Hmm, try/catch on the try {
var dns = require('native-dns');
} catch (err) {
return cb(null, false);
} |
@silverwind Yeah, try/catch doesn't work on async code. native-dns is throwing in async code, wtf... I think the easiest would be to just fork native-dns, apply a fix and depend on that. I don't foresee that PR being merged soon. |
Well, I've found a dirty way to catch it: process.on("uncaughtException", function(e) {
if (err.code === "ENOENT" && path: '/etc/resolv.conf') {
// return offline
}
}); We'd have to immediatly unregister that handler, and I'm not even sure if using Forking it may be the way to go, given that @tjfontaine is probably pretty busy on node. |
@silverwind I'd prefer just forking and fixing. |
There's another maintainer on |
For a short-term fix, we could fork the repo with the fix and include it as a git dependency. I'd set up an upstream remote to |
Yup, but I prefer depending on a tarball: |
Once tjfontaine/node-dns#63 gets merged, we should switch back to using the original version.
This should be resolved. I used my own fork for the case when the forked repo ever gets deleted. Once tjfontaine/node-dns#63 gets merged, we shall switch back to the original version. |
Also, I just verified that the DNS request runs into the timeout when all network interfaces are down, so the behaviour with that patch is fine. |
👍 |
Try turning off your connection then running the tests or the binary.
@silverwind This kinda looks like a native-dns bug. Thoughts?
The text was updated successfully, but these errors were encountered: