-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Implement parallel Happy Eyeballs as described in RFC 8305 #48145
Comments
I originally went for the proper parallel approach as states in RFC8305. I chose not to implement it as I had issues with the code. Consider that implementing proper RFC8305 will imply that all of sudden Node.js starts opening multiple connections instead of one in case of multiple IP returned by DNS, which is dangerous. The unwanted timeouts are not properly handled in #47860, which will be available in Node.js 20 once I fix #48000 and #47822. We can of course disable the feature completely by default, but it was my understanding that this was longly awaited to help beginners struggling with poorly configured dual stack networks. |
Is that a fact? Is there absolutely no way to prevent responding to more than a single address with a TCP ACK packet after having received TCP SYN-ACK? |
Nope, we don't control the connection at that level, AFAIK. @nodejs/libuv Am I wrong? |
I think it should be considered disabling this |
After 20.3.0 all issues should be fixed. Can we please wait for this release before rushing into decisions? |
The |
Not really. We can add a new feature to opt-out Additionally, to mitigate the problem, a simple fix would be to raise the minimum attempt timeout to 500ms to reduce the possibility that IPv4 fails. |
I was interested so I tried reading the RFC as well. TBH I was also confused at first how you can make both "non-simultaneous" and "may occur in parallel" connections. But the key is in 2nd paragraph:
Which is "non-simultaneous" but also "may occur in parallel". |
Not in a portable fashion. I'm not even sure you could do it reliably if all you cared about was Linux. The only way I'm aware of is polling |
@HinataKah0 Yes, I interpreted in that way as well. |
This comment has been minimized.
This comment has been minimized.
On a side note, the implementation in Node.js 20.13.1 also appears to break some
Setting |
Rather than disabling the Happy Eyeballs altogether, you could use |
Meant to comment this on #54359, sorry. Leaving below for posterity. This has been discussed elsewhere before, e.g. #52216 and https://github.com/orgs/nodejs/discussions/48028. I very much agree that Node should provide sensible defaults; I can't see how the current defaults are sensible. As a possibly-helpful datapoint, curl and Python are both able to fetch from I don't know enough about curl/Python/other runtimes to know what they're doing differently, but it's clear that better default behavior is possible, and I hope that it can work its way into Node, even if it has to wait for a future major version. |
What is the problem this feature will solve?
autoSelectFamily
is enabled by default in Node.js 20. However, it does not properly implement parallel connection attempts, which are an integral part of the Happy Eyeballs algorithm. This can cause timeouts to occur that did not occur in versions prior to Node.js 20. See, for example, this discussion.What is the feature you are proposing to solve the problem?
Implement the algorithm as described in Section 5 of RFC 8305:
What alternatives have you considered?
Disabling
autoSelectFamily
and restoring the pre-20 behavior, see #47644 (comment).The text was updated successfully, but these errors were encountered: