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
{{ message }}
Repository navigation
Try other addresses resolved via DNS if the first one fails #417
When available, ipv6 addresses seem to be preferred to IPv4 ones. However, in practice, v6 addresses are much less reliable. This is a pretty big problem for the Mastodon project, since it often gets urls that are served by dual-stack instances with dubious ipv6 setups, and so it ends up timing out on a lot of them, causing issues verifying posts.
It would be very useful if we could configure somehow to prefer ipv4 addresses to ipv6 addresses. I don't think this is an issue with the standard Net::HTTP stack, or with curl, so it would be great to match those behaviors.
That said, what? No. We're using the system resolver, and we are absolutely not going to introduce special logic to second guess it by doing things like prioritizing IPv4 over IPv6, sorry.
It is not so much about doing anything special with the DNS requests or prioritizing IPv4 over IPv6, but rather trying other returned addresses if the first picked one fails. I am not sure there is any standard for that, but it is pretty common to try several addresses whenever a DNS query returns multiple A/AAAA records when the first try fails.
changed the title [-]Connecting to servers that advertise a non-working IPv6 address fails[/-][+]Try other addresses resolved via DNS if the first one fails[/+]on Jun 29, 2017
My 2 cents. Once valid (working) address found - it should probably be cached at least for the given TTL (probably can be configured) so that next request to the same host will "shortcut" on trying those we know not working
@nightpool I fully agree with @ThibG, it is not an IPv6 issue but, just for information: Mastodon does not do any specific treatment, such as preferring IPv6 over IPv4 or the opposite. It is entirely up to your operating system (on Linux, you can change the behaviour by editing /etc/gai.conf.)
Activity
tarcieri commentedon Jun 29, 2017
The preference ordering comes from DNS. http.rb is not doing anything unusual here, at all, it leans on core Ruby to resolve DNS and pick a host:
https://github.com/httprb/http/blob/master/lib/http/timeout/global.rb#L26
That said, what? No. We're using the system resolver, and we are absolutely not going to introduce special logic to second guess it by doing things like prioritizing IPv4 over IPv6, sorry.
ClearlyClaire commentedon Jun 29, 2017
It is not so much about doing anything special with the DNS requests or prioritizing IPv4 over IPv6, but rather trying other returned addresses if the first picked one fails. I am not sure there is any standard for that, but it is pretty common to try several addresses whenever a DNS query returns multiple A/AAAA records when the first try fails.
[-]Connecting to servers that advertise a non-working IPv6 address fails[/-][+]Try other addresses resolved via DNS if the first one fails[/+]tarcieri commentedon Jun 29, 2017
Okay, that's a valid concern. Reopened the issue and updated the title to reflect that
ixti commentedon Jun 29, 2017
My 2 cents. Once valid (working) address found - it should probably be cached at least for the given TTL (probably can be configured) so that next request to the same host will "shortcut" on trying those we know not working
bortzmeyer commentedon Jul 17, 2017
@nightpool I fully agree with @ThibG, it is not an IPv6 issue but, just for information: Mastodon does not do any specific treatment, such as preferring IPv6 over IPv4 or the opposite. It is entirely up to your operating system (on Linux, you can change the behaviour by editing /etc/gai.conf.)