Open mihails-strasuns opened 8 years ago
I'm not sure if this is a libevent bug or if I'm doing something wrong here. The docs say that evdns_init()
parses resolv.conf, and multiple name servers are supported, too, so in theory this should work. In case this isn't fixable within vibe.d, the new vibe-core
module will be usable as a replacement to vibe:core
soon and uses the system provided getaddrinfo(_a)
, which should work as expected.
No problem, this is not really an issue for me, only reporting in case someone else gets confused by it again.
the new vibe-core module will be usable as a replacement to vibe:core soon and uses the system provided getaddrinfo(_a)
Really using a synchronous DNS resolver?
I see, there is getaddrinfo_a(3).
Just debugged libevent, it does parse all nameservers. It even already parses the host file https://github.com/libevent/libevent/blob/release-2.0.16-stable/evdns.c#L3509-L3514.
Indeed seems to be a evdns/libevent bug it doesn't query the DNS servers in order, but tries to query them in round robin order, which might lead to unexpected name resolution errors. https://github.com/libevent/libevent/blob/3821cca1a637f4da4099c9343e7326da00f6981c/evdns.c#L715 Workaround is to fix your resolv.conf setup to have all nameservers return the same responses, or use a local dnsmasq to forward the searches.
Noticed this by accident. I have two DNS servers configured in my
resolv.conf
:First one is local network cache, second provides fallback if first goes down or misses name sync. At some point I have stopped internal DNS cache during some debugging and my vibe.d based scripts started to fail like this:
Changing first
resolv.conf
entry to refer to working DNS server fixed the issue.