~emersion/soju#221: 
Round-robin DNS resolution doesn't work

Bigger IRC networks often have multiple servers distributed across the world. They typically use round-robin DNS to distribute the load across these servers. OFTC has reported to us that chat.sr.ht always connects to the same IP address, despite DNS returning multiple AAAA records in randomized order.

After investigation, it appears that net.LookupIPAddr always returns the records in the same fixed order, undoing the randomization performed by the DNS server. This seems to be caused by Go's implementation of RFC 6724, specifically "Rule 9: Use longest matching prefix". See sortByRFC6724.

Not sure what a solution would look like. Performing the resolution ourselves would require us to re-implement a whole bunch of code, e.g. IPv4 fallback.

Status
REPORTED
Submitter
~emersion
Assigned to
No-one
Submitted
2 months ago
Updated
2 months ago
Labels
bug chat.sr.ht

~emersion 2 months ago

An additional complication seems that in-flight DNS requests are grouped together, and this results in the same order re-used for all of these connections: see Go issue #31698.

Register here or Log in to comment, or comment via email.