Skip to content

Commit

Permalink
make this thread local
Browse files Browse the repository at this point in the history
at least one case of a crash in std::erase_if here.

 #1  0x00007f9d9b8d17f1 in __GI_abort () at abort.c:79
 #2  0x00000000005af591 in Poco::SignalHandler::handleSignal(int) [clone .cold] () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #3  <signal handler called>
 #4  0x0000000000803115 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #5  __gnu_cxx::__exchange_and_add_dispatch (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #6  std::string::_Rep::_M_dispose (__a=..., this=0x1) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:288
 #7  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7f9d7416a5c0, __in_chrg=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:718
 #8  std::destroy_at<std::string> (__location=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #9  std::_Destroy<std::string> (__pointer=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #10 std::_Destroy_aux<false>::__destroy<std::string*> (__last=0x7f9d7416a5d8, __first=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #11 std::_Destroy<std::string*> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #12 std::_Destroy<std::string*, std::string> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #13 std::vector<std::string, std::allocator<std::string> >::~vector (this=0x7f9d7c0fb9c8, __in_chrg=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:730
 #14 net::HostEntry::~HostEntry (this=0x7f9d7c0fb9b8, __in_chrg=<optimized out>) at net/NetUtil.cpp:127
 #15 0x00000000008083e9 in net::DNSCacheEntry::~DNSCacheEntry (this=0x7f9d7c0fb9a8, __in_chrg=<optimized out>) at net/NetUtil.cpp:129
 #16 std::destroy_at<net::DNSCacheEntry> (__location=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #17 std::_Destroy<net::DNSCacheEntry> (__pointer=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #18 std::_Destroy_aux<false>::__destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #19 std::_Destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #20 std::_Destroy<net::DNSCacheEntry*, net::DNSCacheEntry> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #21 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase_at_end (__pos=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1932
 #22 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase (__last=..., __first=
       {queryAddress = "some.address.or.other", queryPort = "", hostEntry = {_requestName = "some.address.or.other", _canonicalName = "", _ipAddresses = std::vector of length 3, capacity 3 = {<error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0xffffffffffffffe8>}, _ainfo = std::shared_ptr<addrinfo> (use count 276, weak count -1) = {get() = 0x7f9d741ffd70}, _errno = 0, _eaino = 0}, lookupTime = {__d = {__r = 1035924226793350}}},
     this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/vector.tcc:196
 #23 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::erase (__last=..., __first=..., this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1561
 #24 std::erase_if<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry>, net::resolveDNS(const std::string&, const std::string&, std::vector<DNSCacheEntry>&)::<lambda(const auto:20&)> > (
     __pred=..., __cont=std::vector of length 2, capacity 8 = {...}) at /opt/rh/devtoolset-12/root/usr/include/c++/12/vector:117
 #25 net::resolveDNS(std::string const&, std::string const&, std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >&) () at net/NetUtil.cpp:144
 #26 0x0000000000808f96 in net::DNSResolver::resolveDNS (port="", addressToCheck="some.address.or.other", this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at net/NetUtil.cpp:171
 #27 net::resolveDNS(std::string const&) () at net/NetUtil.cpp:178
 #28 0x000000000080921a in net::resolveOneAddress(std::string const&) () at net/NetUtil.cpp:194
 #29 0x00000000008092e3 in net::resolveHostAddress(std::string const&) () at net/NetUtil.cpp:205
 #30 0x0000000000809354 in net::isLocalhost(std::string const&) () at net/NetUtil.cpp:227
 #31 0x0000000000811887 in SslStreamSocket::verifyCertificate() () at net/Socket.hpp:995
 #32 0x000000000082447b in SslStreamSocket::doHandshake (this=this@entry=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:266
 #33 0x000000000082471b in SslStreamSocket::readIncomingData (this=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:140
 #34 0x000000000081e02c in StreamSocket::handlePoll (this=0x7f9d7c18d0a0, disposition=..., now=..., events=1) at net/Socket.hpp:1348
 #35 0x0000000000816082 in SocketPoll::poll(long) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1123
 #36 0x0000000000652250 in SocketPoll::poll (timeoutMax=..., this=<optimized out>) at ./net/Socket.hpp:689
 #37 DocumentBroker::pollThread() () at wsd/DocumentBroker.cpp:372
 #38 0x00000000008171a5 in SocketPoll::pollingThreadEntry() () at net/Socket.cpp:390
 #39 0x0000000000be1c83 in execute_native_thread_routine ()
 #40 0x00007f9d9bc896db in start_thread (arg=0x7f9d527fc700) at pthread_create.c:463
 #41 0x00007f9d9b9b274f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie0d9e547dc9b4803ea95848c76302601a996c53a
  • Loading branch information
caolanm authored and vmiklos committed Sep 27, 2024
1 parent 4eb191d commit 20f43dd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/NetUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class DNSResolver

HostEntry resolveDNS(const std::string& addressToCheck)
{
static DNSResolver resolver;
thread_local DNSResolver resolver;
return resolver.resolveDNS(addressToCheck, std::string());
}

Expand Down

0 comments on commit 20f43dd

Please sign in to comment.