From: Otto Date: Wed, 22 Dec 2021 09:00:47 +0000 (+0100) Subject: Do not use boost::format, it is not thread safe when calling into locale handling... X-Git-Tag: auth-4.7.0-alpha1~90^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e64d87fe80aa8368265be2ed87e1dabadf04b84;p=thirdparty%2Fpdns.git Do not use boost::format, it is not thread safe when calling into locale handling code according to tsan. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 1e4ab0a4bc..38fdb65536 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -104,6 +104,19 @@ int SyncRes::s_event_trace_enabled; #define LOG(x) if(d_lm == Log) { g_log <= static_cast(sizeof(buf))) { + return "?"; + } + return std::string(buf, strlen(buf)); +} + static inline void accountAuthLatency(uint64_t usec, int family) { if (family == AF_INET) { @@ -1224,7 +1237,7 @@ vector SyncRes::getAddrs(const DNSName &qname, unsigned int depth, else { LOG(", "); } - LOG((addr.toString())<<"(" << (boost::format("%0.2f") % (speeds[addr]/1000.0)).str() <<"ms)"); + LOG((addr.toString())<<"(" << fmtfloat("%0.2f", speeds[addr]/1000.0) <<"ms)"); } LOG(endl); } @@ -2023,7 +2036,7 @@ inline std::vector> SyncRes::shuffleInSpeedOrder(NsSet LOG(endl<first.toLogString()<<"(" << (boost::format("%0.2f") % (i->second/1000.0)).str() <<"ms)"); + LOG(i->first.toLogString()<<"(" << fmtfloat("%0.2f", i->second/1000.0) <<"ms)"); } LOG(endl); } @@ -2054,7 +2067,7 @@ inline vector SyncRes::shuffleForwardSpeed(const vectortoStringWithPort() <<"(" << (boost::format("%0.2f") % (speeds[*i]/1000.0)).str() <<"ms)"); + LOG((wasRd ? string("+") : string("-")) << i->toStringWithPort() <<"(" << fmtfloat("%0.2f", speeds[*i]/1000.0) <<"ms)"); } LOG(endl); }