mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2273] Resolver takes a long time to resolve NXDOMAIN #945
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#945
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mhils on GitHub (Jul 2, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2273
Describe the bug
When hickory-resolver is configured with more than two nameservers and one of the first two is not reachable, DNS resolution takes five seconds for NXDOMAIN responses.Edit: see https://github.com/hickory-dns/hickory-dns/issues/2273#issuecomment-2205877684
To Reproduce
Output:
Removing the third nameserver reduces the resolution time to normal levels (13ms on my system).
Expected behavior
Faster resolution. :)
System:
Version:
Crate: resolver
Version: v0.24.1 and HEAD
Additional context
Thank you for your fantastic work on hickory! 🍰 ❤️
@bluejekyll commented on GitHub (Jul 3, 2024):
It sounds like the third nameserver is not responding. Is that right?
@mhils commented on GitHub (Jul 3, 2024):
That is correct.
Scenario A: Two nameservers configured, only the first one is responding: Immediate response.
Scenario B: Three nameservers configured, only the first one is responding: 5s timeout.
Here's what WireShark shows for Scenario B. As in the code above, 8.8.8.8 and 9.9.9.9 are unreachable (wrong port):

dns.pcapng.zip
@djc commented on GitHub (Jul 3, 2024):
What is your expected behavior here? If you configure a number of nameservers, wouldn't you expect all of them would be tried? Is there a threshold particular to two nameservers? What happens when you have your "third" (failing to respond) nameserver second (omitting the second nameserver)?
@mhils commented on GitHub (Jul 3, 2024):
Thank you two - I bamboozled myself when turning this into a MRE. 🙈 My non-minified code only had a single non-responsive DNS server. But I was also using
read_system_conf(), andread_system_conf()setstrust_negative_responses = false, which in turn makes the resolver wait...Is there a reason why
trust_negative_responsesis set tofalsefor system configurations? Is that working around some known bugs? The 5s timeout was certainly unexpected for me seeing an immediate NXDOMAIN response in Wireshark.@djc commented on GitHub (Jul 3, 2024):
See #1861 for discussion -- I forget the deep context, maybe @bluejekyll remembers.
@mhils commented on GitHub (Jul 3, 2024):
Thanks @djc!
Doing some archeology here, #1212 moved the trust bit from ResolverOpts to NameServerConfig. This is how
trust_nx_responses: falsewas introduced to system_conf. #1861 then renames it. I can't find any artifacts describing why NXDOMAIN is treated as untrustworthy by default though. :)@djc commented on GitHub (Jul 3, 2024):
Yeah, I think that's deep lore -- I think @bluejekyll must have explained at some point in the past, but not sure where...
There was also https://github.com/hickory-dns/hickory-dns/pull/1556.
@bluejekyll commented on GitHub (Aug 11, 2024):
for reference, the untrusted NXDOMAIN response is due to misconfigured DNS at various companies where the internal DNS ends up responding as authoritative for domains it technically does not manage. I had originally wanted to just chalk that up to "your company has a badly configured DNS", but that meant that in those situations users didn't have an option for make the resolver work in that context.