]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Add a suppression for a race in TCP stats reported by TSAN 10423/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 18 May 2021 15:30:36 +0000 (17:30 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 18 May 2021 15:30:36 +0000 (17:30 +0200)
We might indeed be off by a few connections in the "maximum connections
seen" counter, but we don't care that much.

pdns/dnsdist.hh
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-tcp-downstream.cc
pdns/dnsdistdist/tsan.supp

index e2448fab46268b169967e5e3a59fd9a8a96630cc..a3b220d132c825619af5c76826e367d5403dd7c7 100644 (file)
@@ -1033,6 +1033,8 @@ struct DownstreamState
     qps.addHit();
   }
 
+  void incCurrentConnectionsCount();
+
 private:
   std::string name;
   std::string nameWithAddr;
index 091839b414ce146cf499164c104f7484259b9679..52074b90b8d038156c4373441a7ba83ddd1c79aa 100644 (file)
@@ -186,3 +186,11 @@ DownstreamState::~DownstreamState()
     tid.detach();
   }
 }
+
+void DownstreamState::incCurrentConnectionsCount()
+{
+  auto currentConnectionsCount = ++tcpCurrentConnections;
+  if (currentConnectionsCount > tcpMaxConcurrentConnections) {
+    tcpMaxConcurrentConnections.store(currentConnectionsCount);
+  }
+}
index 9436c881b01da1a17da3d5ec8267788b96e75c0e..a43ca1d37ce980735b3e0e33fed76a287f9afd84 100644 (file)
@@ -351,10 +351,7 @@ bool TCPConnectionToBackend::reconnect()
       d_queries = 0;
 
       d_handler = std::move(handler);
-      ++d_ds->tcpCurrentConnections;
-      if (d_ds->tcpCurrentConnections > d_ds->tcpMaxConcurrentConnections) {
-        d_ds->tcpMaxConcurrentConnections = d_ds->tcpCurrentConnections;
-      }
+      d_ds->incCurrentConnectionsCount();
       return true;
     }
     catch (const std::runtime_error& e) {
index 0899dde574172a5b8e1f0d263b36394e856775a7..2f9978b21f8f2de558782902cad1b62a80fea419 100644 (file)
@@ -4,6 +4,7 @@ race:doLatencyStats
 race:handleStats
 race:ClientState::updateTCPMetrics
 race:DownstreamState::updateTCPMetrics
+race:DownstreamState::incCurrentConnectionsCount
 # There is a race when we update the status of a backend,
 # but eventual consistency is fine there
 race:DownstreamState::setDown