mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[PR #1589] [MERGED] Do not retry the same name server on a negative response #2443
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#2443
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?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/1589
Author: @peterthejohnston
Created: 11/17/2021
Status: ✅ Merged
Merged: 11/24/2021
Merged by: @bluejekyll
Base:
main← Head:main📝 Commits (1)
4471bdfDo not retry the same name server on a negative response📊 Changes
4 files changed (+102 additions, -6 deletions)
View changed files
📝
crates/proto/src/xfer/retry_dns_handle.rs(+10 -1)📝
crates/resolver/src/config.rs(+6 -4)📝
crates/resolver/src/error.rs(+9 -1)➕
tests/integration-tests/tests/retry_dns_handle_tests.rs(+77 -0)📄 Description
Currently in Trust-DNS, there are two mechanisms that allow failed queries to be retried by the resolver:
RetryDnsHandlereattempts queries against the name server pool if they failThe name server pool retries basically any unsuccessful response against fallback name servers, unless it gets a
trustedNoRecordsFounderror, which occurs whenNameServerConfig::trust_nx_responsesis true for that server and the resolver received an emptyNXDomainresponse.The
RetryDnsHandleuses theRetryableErrortrait to determine if an error should be retried. However, the implementation ofRetryableError::should_retryforResolveErroruses the same criteria as the name server pool, which I think is not the desired behavior. This leads to the same query being retried to the same name server when it shouldn't be.For example (this was real behavior observed when testing the resolver on a device running Fuchsia):
NODATAresponse from the first name server, and the name server pool retries the query on the other ones, getting the same responseRetryDnsHandlenow retries that entire query over the whole name server pool again, because it got an error for whichRetryableError::should_retryistrue. This happensResolverOpts::attemptsnumber of times.in effect, we send this query 3 (# of name servers) * 3 (# of total attempts) = 9 times, 3 times to each name server. The name server pool is used correctly here to retry on a negative response; however, the RetryDnsHandle should probably only be used on IO errors (e.g. we failed to connect to a given server) or other errors on which it's reasonable to ask the same name server again. If we successfully get a negative response from a server, e.g. a
NODATAresponse, it doesn't make sense to expect an OK response when we retry, so we should not be retrying the query to that same name server.The desired end state is one where, if the resolver encounters no IO errors, only one query is made to each name server in the pool, at most.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.