]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Avoid mthread race when using the set of rootNSZones. 8544/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 6 Nov 2019 10:15:30 +0000 (11:15 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 18 Nov 2019 12:45:17 +0000 (12:45 +0000)
pdns/reczones.cc

index 159776996bfbbf8fdf24133805d94dd5789e17ad..60621052f785154200c344dffe71681844c9b5a6 100644 (file)
@@ -126,7 +126,11 @@ void primeRootNSZones(bool dnssecmode)
     sr.setDoDNSSEC(true);
     sr.setDNSSECValidationRequested(true);
   }
-  for (const auto & qname: t_rootNSZones) {
+
+  // beginResolve() can yield to another mthread that could trigger t_rootNSZones updates,
+  // so make a local copy
+  set<DNSName> copy(t_rootNSZones);  
+  for (const auto & qname: copy) {
     t_RC->doWipeCache(qname, false, QType::NS);
     vector<DNSRecord> ret;
     sr.beginResolve(qname, QType(QType::NS), QClass::IN, ret);