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
Undici throws a ConnectTimeoutError when there is no connection #1484
Comments
I cannot reproduce the error at all on Linux or Mac. @ronag could you take a look too? |
@mcollina I can reproduce it with
then try to write the output on a file and search for TIMEOUT. something like
|
Seems like the long running loop execution is blocking the event loop from moving the error event callback from the callback queue to the stack which leads to a timeout and the TO callback is appearing in the callback queue before the error event callback because we defer the error event to the next tick: https://github.com/nodejs/node/blob/main/lib/net.js#L1144 a quick test of deferring the definition of the setTimout to the next tick fixes the problem:
|
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
sure, I'll prepare a PR ASAP |
created the following PR: #1551 |
reproduce script:
|
Bug Description
If you try to send an HTTP request, but the DNS lookup for the requested domain name fails, Undici may throw a
ConnectTimeoutError
.Reproducible By
I wrote a simple script which reproduces the issue
I used undici@5.4.0
Expected Behavior
I'd expect to get only errors which indicate that the DNS lookup has failed.
Logs & Screenshots
Kazam_screencast_00184.mp4
Environment
Ubuntu 20.04.4 LTS, Node v16.13.0
The text was updated successfully, but these errors were encountered: