]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add incremental slave-check backoff also for failed AXFR due to master problems
authorKlaus Darilion <klaus.darilion@nic.at>
Tue, 31 Jul 2018 21:01:42 +0000 (21:01 +0000)
committerKlaus Darilion <klaus.darilion@nic.at>
Tue, 31 Jul 2018 21:01:42 +0000 (21:01 +0000)
If SOA-checks against a master with failing AXFR still succeed, we would
constantly try to AXFR the zone. To avoid this, we add the zone to the list
of failed slave-checks to suspend slave-checks (and subsequent AXFR) for
this zone for some time.

pdns/slavecommunicator.cc

index 9dd57548b8b4494cd602226068699cb9c7c18255..ec5cfb4d02913c809da726ea80503b84d3358ae1 100644 (file)
@@ -615,7 +615,17 @@ void CommunicatorClass::suck(const DNSName &domain, const ComboAddress& remote)
     }
   }
   catch(ResolverException &re) {
-    g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<endl;
+    // The AXFR probably failed due to a problem on the master server. If SOA-checks against this master
+    // still succeed, we would constantly try to AXFR the zone. To avoid this, we add the zone to the list of
+    // failed slave-checks. This will suspend slave-checks (and subsequent AXFR) for this zone for some time.
+    uint64_t newCount = 1;
+    time_t now = time(0);
+    const auto failedEntry = d_failedSlaveRefresh.find(domain);
+    if (failedEntry != d_failedSlaveRefresh.end())
+      newCount = d_failedSlaveRefresh[domain].first + 1;
+    time_t nextCheck = now + std::min(newCount * d_tickinterval, (uint64_t)::arg().asNum("soa-retry-default"));
+    d_failedSlaveRefresh[domain] = {newCount, nextCheck};
+    g_log<<Logger::Error<<"Unable to AXFR zone '"<<domain<<"' from remote '"<<remote<<"' (resolver): "<<re.reason<<" (This was the "<<(newCount == 1 ? "first" : std::to_string(newCount) + "th")<<" time. Excluding zone from slave-checks until "<<nextCheck<<")"<<endl;
     if(di.backend && transaction) {
       g_log<<Logger::Error<<"Aborting possible open transaction for domain '"<<domain<<"' AXFR"<<endl;
       di.backend->abortTransaction();