PowerDNS / pdns

PowerDNS Authoritative, PowerDNS Recursor, dnsdist
https://www.powerdns.com/
GNU General Public License v2.0
3.7k stars 908 forks source link

rec: recursor asks the same question repeatedly in some cases #9565

Open omoerbeek opened 4 years ago

omoerbeek commented 4 years ago

See #9559, the test_glueless_referral_loop test varies in number of queries and shows repeating the same question ot nameservers for one trace. We need to understand why.

omoerbeek commented 4 years ago

Some observation I did while investigating what is going on:

We hit the case of beenthere. But how/when exactly is dependent on the order we pick the NS to check (which is shuffled randomly). So the spot where the loop detection kicks in in getBestNSFromCache(by disregarding the the NS found in the cache: bestns.clear()) is dependent on (bad) luck. This empty list is returned once we hit the

ns2.powerdns.org: We have NS in cache for '.' but part of LOOP (already seen ns2.powerdns.org )! Trying less specific NS

case which leads up in the end to:

ns2.powerdns.org: Failed to resolve via any of the 0 offered NS at level '.'

If we first pick ns1 and then ns1, loop detection will kick in earlier than if we fist select ns1, then ns2 and then either one.

AFAIKS, this explains both the non-deterministic behaviour and the repeated questions. I do not know atm if it is worth the trouble to fix this.

omoerbeek commented 4 years ago

It turns out the analysis is not 100% correct. The determining factor seems to be that there are multiple IPs available per NS. By switching off IPv6 support the test becomes deterministic.