resolver: try servers in a random order on each resolution (closes #138)
check / check (push) Failing after 2m19s

Every resolution walked the root servers in a fixed order, so
a.root-servers.net got every first query and its timeouts were paid on
every lookup. Each list of servers the resolver walks, the root servers
and the nameservers of each zone below them, is now walked in a random
order from the standard library's rand.Shuffle, chosen anew each time.
Failover is unchanged: a server that does not reply, or refuses, is
passed over for the next; any other reply, even a SERVFAIL, is used.
The shuffle is passed in, so the tests check the order with a seeded
source; which server a live query reached is not observable, so no
test fails if the walk stops shuffling.

Model: opus-5-5
This commit is contained in:
2026-10-01 22:47:08 +00:00
parent 97c8138c85
commit 87aa5c2d04
5 changed files with 73 additions and 3 deletions
+5
View File
@@ -401,6 +401,11 @@ performs full iterative resolution:
4. **Authoritative query**: Queries all discovered authoritative nameservers
directly for the requested records.
In steps 2 and 3 the servers are asked one at a time in a random order, chosen
anew each time, so no one root server gets every first query. A server that does
not reply, or refuses the query, is passed over for the next one; the first
other reply is used, even a SERVFAIL, and no further server is asked.
This approach ensures:
- Independence from any upstream resolver's cache or filtering.