From: Remi Gacogne Date: Thu, 29 Apr 2021 11:26:24 +0000 (+0200) Subject: dnsdist: Exclude the TCP latency calculations from TSAN analysis X-Git-Tag: dnsdist-1.7.0-alpha1~45^2~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccff36b21cf751c10effb130381517362acc0dc2;p=thirdparty%2Fpdns.git dnsdist: Exclude the TCP latency calculations from TSAN analysis They are indeed racy in some cases, but we do not care about perfect accuracy there. --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 6653cee5dd..aa4a47d31d 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -347,6 +347,11 @@ static IOState sendQueuedResponses(std::shared_ptr& return IOState::Done; } +static void updateTCPLatency(const std::shared_ptr& ds, double udiff) +{ + ds->latencyUsecTCP = (127.0 * ds->latencyUsecTCP / 128.0) + udiff/128.0; +} + static void handleResponseSent(std::shared_ptr& state, const TCPResponse& currentResponse) { if (currentResponse.d_idstate.qtype == QType::AXFR || currentResponse.d_idstate.qtype == QType::IXFR) { @@ -363,7 +368,7 @@ static void handleResponseSent(std::shared_ptr& stat ::handleResponseSent(ids, udiff, state->d_ci.remote, ds->remote, static_cast(currentResponse.d_buffer.size()), currentResponse.d_cleartextDH); - ds->latencyUsecTCP = (127.0 * ds->latencyUsecTCP / 128.0) + udiff/128.0; + updateTCPLatency(ds, udiff); } } diff --git a/pdns/dnsdistdist/dnsdist-tsan.supp b/pdns/dnsdistdist/dnsdist-tsan.supp index 0899dde574..39ffe6cd48 100644 --- a/pdns/dnsdistdist/dnsdist-tsan.supp +++ b/pdns/dnsdistdist/dnsdist-tsan.supp @@ -1,6 +1,7 @@ # Part of that code has a race indeed, where we read the value then update it # We don't really care for these metrics race:doLatencyStats +race:updateTCPLatency race:handleStats race:ClientState::updateTCPMetrics race:DownstreamState::updateTCPMetrics