You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The results returned by getaddrinfo are reordered, giving preference to ipv4 addresses. The explanation given in #4693 seems unsatisfactory. Not implementing happy eyeballs is a reasonable design decision, of course, but why does that mean ipv4? It should mean taking the first entry. At the moment node is deliberately defying the system configuration.
As I understand it, without the reordering, ipv6 addresses could be the first entry, which would break anywhere that doesn't have an ipv6 stack. The current implementation is intentional in order to give preference to ipv4. /cc @bnoordhuis
Reacted by Ray Bellis, Christian, Tristan, Maurice Walker, treysis, Fernando van Loenhout, Miyuru, Paul-Louis Ageneau, Lukáš Kvídera, ronnyaa and 1 more
would the dns.ADDRCONFIG flag mitigate the problem?
Only partially. AI_ADDRCONFIG means 'return AAAA entries only when there is a configured IPv6 interface' but the presence of such an interface doesn't say anything about IPv6 traffic actually being routable. (That's true for IPv4 as well, of course; my point is that AI_ADDRCONFIG isn't a fix per se.)
We made the decision to prefer IPv4 over IPv6 three or four years ago when IPv6 support was much more spotty than it is today. It's something we can reconsider if the majority thinks it's a good idea.
This is clearly a violation of the principle of least astonishment and I don't see how adding documentation is going to help. Hardly anyone affected by this will be using the dns module directly. It took me half a day before realizing my issue was with the dns module. Since then I have put a workaround in place and am no longer affected. Still, I think you should slowly phase out this odd logic. IMHO, over time, keeping it will hurt more than it helps.
That fix would default the family to 6 iff the caller isn't asking for all families. However, most of the time the caller should be asking for all families. Even if that was not the case, changing defaults is a mean thing to do to clients.
Generally any caller should ask for all families and then try the results in-order. If the caller were to implement happy eyeballs they would ask for all and concurrently try the per-familiy subsequences in-order.
IMHO the proper way to fix this is to apply #4693. Whether to happy eyeball or not is orthogonal.
(@benschulz commented on 25 Apr 2016 • edited) This is clearly a violation of the principle of least astonishment and I don't see how adding documentation is going to help. Hardly anyone affected by this will be using the dns module directly. It took me half a day before realizing my issue was with the dns module. Since then I have put a workaround in place and am no longer affected. Still, I think you should slowly phase out this odd logic. IMHO, over time, keeping it will hurt more than it helps.
and believe that #4693 is the correct way forward — in 7.x+
This is your project and you are free to take it in any direction you please. If you think the status quo is good enough or even right, you should close the ticket. All I can tell you is that I had a really rough time with this. But that's just one data point, I imagine there are several more people affected.
Fermi estimate: Two people have raised the issue; if we conservatively posit that .1‒1% of those affected manage to figure out the root cause and find this report, it'd be around 200‒2000 people affected in total.
Hope that helps. :P
Edit: Added missing "affected" qualifier. =)
Reacted by Refael Ackermann, Anton Rudeshko, treysis and ronnyaa
The code is open source, so if anyone wants to adapt it to their needs, please feel free.
If anyone would like me to make a PR to node with the code adapted for nodejs core, please let me know and how exactly it should be integrated.
As IPv4 addresses are exhausted, this will be more and more of a problem, especially on mobile networks, and especially in developing countries with large populations.
It's probably best to go ahead and prepare for it now if we can!
Activity
jasnell commentedon Apr 20, 2016
As I understand it, without the reordering, ipv6 addresses could be the first entry, which would break anywhere that doesn't have an ipv6 stack. The current implementation is intentional in order to give preference to ipv4. /cc @bnoordhuis
addaleax commentedon Apr 20, 2016
Is this still a problem when using the latest v6 release candidate (aka is this fixed by #6021)?
cjihrig commentedon Apr 20, 2016
The DNS hints aren't related to the reordering.
cjihrig commentedon Apr 20, 2016
@bnoordhuis would the
dns.ADDRCONFIGflag mitigate the problem?benschulz commentedon Apr 20, 2016
As I understand it, the proper place to configure preferences is via gai.conf.
Snippet from my gai.conf:
bnoordhuis commentedon Apr 20, 2016
Only partially.
AI_ADDRCONFIGmeans 'return AAAA entries only when there is a configured IPv6 interface' but the presence of such an interface doesn't say anything about IPv6 traffic actually being routable. (That's true for IPv4 as well, of course; my point is thatAI_ADDRCONFIGisn't a fix per se.)We made the decision to prefer IPv4 over IPv6 three or four years ago when IPv6 support was much more spotty than it is today. It's something we can reconsider if the majority thinks it's a good idea.
jasnell commentedon Apr 22, 2016
There are likely two things that can happen here:
benschulz commentedon Apr 25, 2016
This is clearly a violation of the principle of least astonishment and I don't see how adding documentation is going to help. Hardly anyone affected by this will be using the dns module directly. It took me half a day before realizing my issue was with the dns module. Since then I have put a workaround in place and am no longer affected. Still, I think you should slowly phase out this odd logic. IMHO, over time, keeping it will hurt more than it helps.
igalic commentedon Dec 23, 2016
from what i gather, this is possibly the source of my issue with
npm installfailing (a possible regression of npm/npm#6857)This time i'm running alpine (hence, muslc) under docker, again, IPv6-only network.
note that musl implements rfc 3484/6724.
this works fine in ruby, btw:
from what i gather, this can be fixed with:
benschulz commentedon Dec 27, 2016
That fix would default the family to 6 iff the caller isn't asking for all families. However, most of the time the caller should be asking for all families. Even if that was not the case, changing defaults is a mean thing to do to clients.
Generally any caller should ask for all families and then try the results in-order. If the caller were to implement happy eyeballs they would ask for all and concurrently try the per-familiy subsequences in-order.
IMHO the proper way to fix this is to apply #4693. Whether to happy eyeball or not is orthogonal.
sam-github commentedon Dec 29, 2016
Happy Eyeballs - for those who haven't heard the term
igalic commentedon Feb 3, 2017
every month or two, i try a fresh major release of nodejs, only to find this issue is still there.
i highly agree with @benschulz here:
and believe that #4693 is the correct way forward — in 7.x+
Trott commentedon Jul 16, 2017
Should this remain open? (I'm guessing the answer is "yes" but would be happy to find out I'm wrong.)
benschulz commentedon Jul 16, 2017
This is your project and you are free to take it in any direction you please. If you think the status quo is good enough or even right, you should close the ticket. All I can tell you is that I had a really rough time with this. But that's just one data point, I imagine there are several more people affected.
Fermi estimate: Two people have raised the issue; if we conservatively posit that .1‒1% of those affected manage to figure out the root cause and find this report, it'd be around 200‒2000 people affected in total.
Hope that helps. :P
Edit: Added missing "affected" qualifier. =)
77 remaining items
zwhitchcox commentedon Sep 26, 2021
For all interested parties, I have implemented happy eyeballs for my company, Balena, here:
https://github.com/balena-io-modules/fetch
The code is open source, so if anyone wants to adapt it to their needs, please feel free.
If anyone would like me to make a PR to node with the code adapted for nodejs core, please let me know and how exactly it should be integrated.
As IPv4 addresses are exhausted, this will be more and more of a problem, especially on mobile networks, and especially in developing countries with large populations.
It's probably best to go ahead and prepare for it now if we can!
zwhitchcox commentedon Oct 1, 2021
Ok, I have created another repo which implements "happy eyeballs" and will patch the
http(s).Agents to default to the happy eyeballs algorithm:https://www.npmjs.com/package/happy-eyeballs
With this package you can just add
to the top of your file to default all
createConnectioncalls to use happy eyeballs.I will be making a PR to NodeJS core as well.
telmich commentedon Oct 1, 2021
That is amazing to see, thanks a lot, @zwhitchcox!