Open paolobarbolini opened 1 year ago
Go by default enables HappyEyeballs in TCP connections and will fallback under 300ms, (although we currently do not make it possible to customize the fallback delay): https://github.com/nats-io/nats-server/blob/main/server/util.go#L260-L266
Go may support it but the current implementation gives it just one random IP per connect attempt so there's nothing Happy Eyeballs can do
What version were you using?
nats-server: v2.10.1
What environment was the server running in?
Is this defect reproducible?
Scenario 1 - Leafnode is also on a dualstack network
The leafnode uses IPv4 and IPv6 interchangeably.
Scenario 2- Leafnode runs on an IPv4 only network (may also apply to an IPv6 only network)
Depending on how the leafnode shuffles the IP addresses obtained from the DNS query it may connect via IPv4 or may instead try using IPv6 and fail with
[ERR] Error trying to connect as leafnode to remote server "(domain name):7422" (attempt 1): dial tcp [(IPv6 address)]:7422: connect: network is unreachable
. On second attempt the leafnode will connect over IPv4 so everything's still going to end-up working fine.Given the capability you are leveraging, describe your expectation?
First scenario
Implement Happy Eyeballs giving preference to IPv6
Second scenario
I'm not sure how far we can get here but it may be possible to detect we're not on a dualstack network and as long as we're able to connect using one of the addresses we ignore errors from other addresses?
Given the expectation, what is the defect you are observing?
The implementation isn't dual-stack aware.