-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
DNS lookup failure dns.js:82 #4545
Comments
Looks like getaddrinfo returned an empty list of results somehow? I thought that would fail with EAI_NODATA. Do you have a small reproducible test case? |
@allthetime can you post the hostname of that sftp server? |
@saghul it seems like https://github.com/nodejs/node/blob/master/src/cares_wrap.cc#L947 might be the cause of this. |
@evanlucas it could be, yes. I'd say there is nothing to fix here other than documentation. It's possible the list comes back empty, so one should look out for that. |
Well we are assuming that the array has at least one element |
Bad assumption, I guess 😄 |
AfterGetAddrInfo() can potentially return an empty array of results without setting an error value. The JavaScript layer expects the array to have at least one value if an error is not returned. This commit sets a UV_EAI_NODATA error when an empty result array is detected. Fixes: nodejs#4545
This seems to be the same as nodejs/node-v0.x-archive#8698 I too see this when hitting EMFILE errors, same on (all?) versions of node (testing on 4.2.3 and 5.4.0). Interestingly, when running with a version of node compiled with |
If you are seeing EMFILE errors you should raise the file descriptor limits
|
AfterGetAddrInfo() can potentially return an empty array of results without setting an error value. The JavaScript layer expects the array to have at least one value if an error is not returned. This commit sets a UV_EAI_NODATA error when an empty result array is detected. Fixes: #4545 PR-URL: #4715 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
@saghul that is a good for dev only work-around, not a solution, and will only differ the problem. What do you do when the security limits have already been increased to the max the machine can physically handle? In my case, a more robust solution would be to refactor the app so that a) we use connection pooling and b) we don't keep the connections open while we process the request. However, that is a architecture flaw and besides the point: this is a confirmed bug and EMFILE helps reproduce it reliably. A node process should not crash, as described in this issue, when EMFILE gets hit. To easily reproduce this error, these conditions need to exists.
With these conditions met, run the app and wait for the error. Strangely, this does not happen when running with the debug version of node, node_g, compiled with the --debug and --gdb option. Maybe this is because the debug version introduces some delay that mitigates an underlying race condition. |
We try hard to make EMFILE errors propagate as far up as possible (IIRC), so Node doesn't crash and your application handles those. AFAIS the patch @cjihrig made does not alter that behavior, because it only applies if
It defaults to 256 on OSX, BTW. |
Yes, the crash in JavaScript was the result of |
AfterGetAddrInfo() can potentially return an empty array of results without setting an error value. The JavaScript layer expects the array to have at least one value if an error is not returned. This commit sets a UV_EAI_NODATA error when an empty result array is detected. Fixes: #4545 PR-URL: #4715 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
AfterGetAddrInfo() can potentially return an empty array of results without setting an error value. The JavaScript layer expects the array to have at least one value if an error is not returned. This commit sets a UV_EAI_NODATA error when an empty result array is detected. Fixes: #4545 PR-URL: #4715 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
AfterGetAddrInfo() can potentially return an empty array of results without setting an error value. The JavaScript layer expects the array to have at least one value if an error is not returned. This commit sets a UV_EAI_NODATA error when an empty result array is detected. Fixes: nodejs#4545 PR-URL: nodejs#4715 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
Hi. TL;DR Any chance the fix gets back-ported to 4.x? I am on Ubuntu 16.04.1 LTS which is stuck with 4.2.6 at the moment. |
here's the relevant line in node.js lib (https://github.com/nodejs/node/blob/master/lib/dns.js#L82)
I have a bot running that polls an sftp server for the existence of a file that is uploaded daily. It connects to socketio so that it can make posts to our main app.
It has suddenly not been working properly for the last 3 days. We have made no changes to the relevant code for a couple of weeks and the stack trace is incredibly unhelpful as it doesn't show what initiated it.
This seems to be happening before the request to the sftp server is made because I would be getting more feedback/logs. The bot successfully connects to our socket server as well, so I'm at a loss for where DNS is even being hit.
connect to socket io --> poll sftp server --> grab file when ready
is all that is happening, so it seems something is happening in the nodejs blackbox between step one and two...
any ideas?
The text was updated successfully, but these errors were encountered: