c-ares: Fail to resolve after DNS server dies and another server starts
After upgrade from 1.20.1 to 1.22.1 we are noticing failures in test that checks switching from a dead DNS server to an alive one.
The test: 0) Sets the following c-ares options https://github.com/userver-framework/userver/blob/00d7a3ddf31c318a92fde08f19f4d8c5159a7e48/core/src/clients/dns/net_resolver.cpp#L179-L192
- Calls
ares_set_servers_ports_csvwith [::1]:3000 and [::1]:3001 - Start DNS server at
[::1]:3000(DNS server at[::1]:3001is not started!) - Resolve some hosts via c-ares
- Kill DNS server at
[::1]:3000and start a new DNS server at[::1]:3001 - Resolve a host
- Kill DNS server at
[::1]:3001and start a DNS server at[::1]:3000 - Attempt to resolve a host times out (timeout=15 seconds). However the DNS server at
[::1]:3000was requested by c-ares and the DNS server successfully responded in the same second it was requested
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (10 by maintainers)
closing since this appears to work as expected
FYI, we have a release prepped for c-ares 1.24.0 that we’d like to get out the door. I’d like to hold the release up to a couple of days to figure this issue out, however. So as much information you can provide would be appreciated so we can get to the bottom of this.
I’ve confirmed what I said is accurate, the mock server doesn’t send anything at all, it acts like a lost packet which is normal for UDP since its connectionless: https://github.com/c-ares/c-ares/blob/main/test/ares-test.cc#L422
You can see this too when running
./bin/arestest -v --gtest_filter=*ServerNoResponseFailover*, note the missing “sending reply” for the requests that are dropped:Have you tried the patch from #651 ?