forked from PowerDNS/pdns
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More dnsname part2 #5
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Habbie
pushed a commit
that referenced
this pull request
May 10, 2018
dnspcap2calidns: Add manpage and packaging
Habbie
pushed a commit
that referenced
this pull request
Dec 17, 2020
Reported by UBSan: sillyrecords.cc:301:42: runtime error: signed integer overflow: 2031844648 - -2147483648 cannot be represented in type 'int' #0 0x55ab56ff5fbd in LOCRecordContent::getZoneRepresentation(bool) const /home/travis/build/rgacogne/pdns/pdns/recursordist/pdns-recursor-0.0.0.0.HEAD.ge217873f32.dirty/sillyrecords.cc:301:42 #1 0x55ab571da021 in test_dnsrecords_cc::test_record_types::test_method() /home/travis/build/rgacogne/pdns/pdns/recursordist/pdns-recursor-0.0.0.0.HEAD.ge217873f32.dirty/test-dnsrecords_cc.cc:232:11 #2 0x55ab571c9a4a in test_dnsrecords_cc::test_record_types_invoker() /home/travis/build/rgacogne/pdns/pdns/recursordist/pdns-recursor-0.0.0.0.HEAD.ge217873f32.dirty/test-dnsrecords_cc.cc:42:1 #3 0x55ab57136125 in boost::unit_test::ut_detail::callback0_impl_t<boost::unit_test::ut_detail::unused, void (*)()>::invoke() /usr/include/boost/test/utils/callback.hpp:89:46 #4 0x2b0b90cfa1f0 (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x681f0) #5 0x2b0b90cd5545 in boost::execution_monitor::catch_signals(boost::unit_test::callback0<int> const&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x43545) #6 0x2b0b90cd5d82 in boost::execution_monitor::execute(boost::unit_test::callback0<int> const&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x43d82) #7 0x2b0b90cfa2f1 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::unit_test::test_case const&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x682f1) #8 0x2b0b90ce3f93 in boost::unit_test::framework_impl::visit(boost::unit_test::test_case const&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x51f93) #9 0x2b0b90d12d22 in boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x80d22) #10 0x2b0b90d12d22 in boost::unit_test::traverse_test_tree(boost::unit_test::test_suite const&, boost::unit_test::test_tree_visitor&) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x80d22) #11 0x2b0b90cdf4b9 in boost::unit_test::framework::run(unsigned long, bool) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x4d4b9) #12 0x2b0b90cf7ed3 in boost::unit_test::unit_test_main(bool (*)(), int, char**) (/usr/lib/x86_64-linux-gnu/libboost_unit_test_framework.so.1.54.0+0x65ed3) #13 0x2b0b92d59f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44) #14 0x55ab56b37961 in _start (/home/travis/build/rgacogne/pdns/pdns/recursordist/pdns-recursor-0.0.0.0.HEAD.ge217873f32.dirty/testrunner+0x1bc3961) (cherry picked from commit 98576e1)
Habbie
added a commit
that referenced
this pull request
Jan 6, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115
Habbie
added a commit
that referenced
this pull request
Jan 6, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115
Habbie
added a commit
that referenced
this pull request
Jan 6, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115
Habbie
added a commit
that referenced
this pull request
Jan 7, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115
Habbie
added a commit
that referenced
this pull request
Jan 7, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115
Habbie
added a commit
that referenced
this pull request
Jan 8, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115 (cherry picked from commit 1a2d029)
Habbie
added a commit
that referenced
this pull request
Jan 11, 2021
==8618==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd8c5a1420 at pc 0x55bee0a5d899 bp 0x7ffd8c5a0710 sp 0x7ffd8c5a0708 READ of size 1 at 0x7ffd8c5a1420 thread T0 #0 0x55bee0a5d898 in YAML::Node::begin() const /usr/include/yaml-cpp/node/impl.h:284:8 #1 0x55bee0a3f2f0 in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:163:27 #2 0x55bee0a3d0d3 in GeoIPBackend::GeoIPBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:86:5 #3 0x55bee0a784eb in GeoIPFactory::make(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/modules/geoipbackend/geoipbackend.cc:1008:16 #4 0x55bedff6cb18 in BackendMakerClass::all(bool) /opt/project/pdns/dnsbackend.cc:200:46 #5 0x55bee07d3abe in UeberBackend::UeberBackend(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/ueberbackend.cc:479:28 #6 0x55bee060579c in PacketHandler::PacketHandler() /opt/project/pdns/packethandler.cc:65:32 #7 0x55bedfee1748 in std::unique_ptr<PacketHandler, std::default_delete<PacketHandler> > make_unique<PacketHandler>() /opt/project/pdns/./misc.hh:571:35 #8 0x55bee079376d in TCPNameserver::go() /opt/project/pdns/tcpreceiver.cc:85:9 #9 0x55bedfecf7b7 in mainthread() /opt/project/pdns/common_startup.cc:656:7 #10 0x55bee0655f67 in main /opt/project/pdns/receiver.cc:654:5 #11 0x7f374b4b809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a) #12 0x55bedfc9a989 in _start (/opt/pdns-auth/sbin/pdns_server+0x2736989) Address 0x7ffd8c5a1420 is located in stack of thread T0 at offset 3040 in frame #0 0x55bee0a3d5ef in GeoIPBackend::initialize() /opt/project/modules/geoipbackend/geoipbackend.cc:115 (cherry picked from commit 1a2d029)
Habbie
pushed a commit
that referenced
this pull request
Apr 23, 2021
So that there is no race when these vaues are read by the SNMP or web threads and updated by the health check thread at the same time. Reported by Thread Sanitizer: WARNING: ThreadSanitizer: data race (pid=11167) Write of size 8 at 0x7b7400002558 by thread T18: #0 healthChecksThread() /opt/project/pdns/dnsdistdist/dnsdist.cc:1712:22 (dnsdist+0xf2a4a2) #1 void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:60:14 (dnsdist+0xf40ea2) #2 std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:95:14 (dnsdist+0xf40e0d) #3 decltype(std::__invoke(_S_declval<0ul>())) std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:244:13 (dnsdist+0xf40dd5) #4 std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:253:11 (dnsdist+0xf40d95) #5 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:196:13 (dnsdist+0xf40c29) #6 <null> <null> (libstdc++.so.6+0xbbb2e) Previous read of size 8 at 0x7b7400002558 by thread T2: #0 backendStatTable_handler(netsnmp_mib_handler_s*, netsnmp_handler_registration_s*, netsnmp_agent_request_info_s*, netsnmp_request_info_s*) /opt/project/pdns/dnsdistdist/dnsdist-snmp.cc:356:62 (dnsdist+0xeccf98) #1 netsnmp_call_next_handler <null> (libnetsnmpagent.so.30+0x2a0cc) #2 SNMPAgent::handleSNMPQueryCB(int, boost::any&) /opt/project/pdns/dnsdistdist/snmp-agent.cc:96:13 (dnsdist+0xfb0847) #3 boost::detail::function::void_function_invoker2<void (*)(int, boost::any&), void, int, boost::any&>::invoke(boost::detail::function::function_buffer&, int, boost::any&) /usr/include/boost/function/function_template.hpp:118:11 (dnsdist+0x8937d8) #4 boost::function2<void, int, boost::any&>::operator()(int, boost::any&) const /usr/include/boost/function/function_template.hpp:768:14 (dnsdist+0xf9d56c) #5 EpollFDMultiplexer::run(timeval*, int) /opt/project/pdns/dnsdistdist/epollmplexer.cc:176:7 (dnsdist+0xfd041b) #6 SNMPAgent::worker() /opt/project/pdns/dnsdistdist/snmp-agent.cc:141:24 (dnsdist+0xfb0b6f) #7 void std::__invoke_impl<void, void (SNMPAgent::*)(), SNMPAgent*>(std::__invoke_memfun_deref, void (SNMPAgent::*&&)(), SNMPAgent*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:73:14 (dnsdist+0xf344c9) #8 std::__invoke_result<void (SNMPAgent::*)(), SNMPAgent*>::type std::__invoke<void (SNMPAgent::*)(), SNMPAgent*>(void (SNMPAgent::*&&)(), SNMPAgent*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:95:14 (dnsdist+0xf343c1) #9 decltype(std::__invoke(_S_declval<0ul>(), _S_declval<1ul>())) std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:244:13 (dnsdist+0xf3436e) #10 std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:253:11 (dnsdist+0xf34315) #11 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:196:13 (dnsdist+0xf34079) #12 <null> <null> (libstdc++.so.6+0xbbb2e)
Habbie
pushed a commit
that referenced
this pull request
May 26, 2021
Unless I'm mistaken, the report (below) is a false positive since `std::atomic<T>::operator T` is equivalent to `load()` and `std::atomic<T>::operator=` to `store()`, but perhaps I'm missing something. Note that I could not reproduce the issue using clang++ 11.1.0's TSAN, only with the one from g++ 11.1.0. ``` ================== WARNING: ThreadSanitizer: data race (pid=11157) Atomic read of size 8 at 0x7b7400002580 by thread T2: #0 __tsan_atomic64_load <null> (dnsdist+0x7a6eb0) #1 std::atomic<double>::load(std::memory_order) const /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/atomic:250:2 (dnsdist+0x83c4da) #2 pdns::stat_t_trait<double>::operator double() const /opt/project/pdns/dnsdistdist/./stat_t.hh:67:60 (dnsdist+0xd05b2e) #3 backendStatTable_handler(netsnmp_mib_handler_s*, netsnmp_handler_registration_s*, netsnmp_agent_request_info_s*, netsnmp_request_info_s*) /opt/project/pdns/dnsdistdist/dnsdist-snmp.cc:356:54 (dnsdist+0xeceab8) #4 netsnmp_call_next_handler <null> (libnetsnmpagent.so.30+0x2a0cc) #5 SNMPAgent::handleSNMPQueryCB(int, boost::any&) /opt/project/pdns/dnsdistdist/snmp-agent.cc:96:13 (dnsdist+0xfb2417) #6 boost::detail::function::void_function_invoker2<void (*)(int, boost::any&), void, int, boost::any&>::invoke(boost::detail::function::function_buffer&, int, boost::any&) /usr/include/boost/function/function_template.hpp:118:11 (dnsdist+0x8956e8) #7 boost::function2<void, int, boost::any&>::operator()(int, boost::any&) const /usr/include/boost/function/function_template.hpp:768:14 (dnsdist+0xf9f13c) #8 EpollFDMultiplexer::run(timeval*, int) /opt/project/pdns/dnsdistdist/epollmplexer.cc:176:7 (dnsdist+0xfd1feb) #9 SNMPAgent::worker() /opt/project/pdns/dnsdistdist/snmp-agent.cc:141:24 (dnsdist+0xfb273f) #10 void std::__invoke_impl<void, void (SNMPAgent::*)(), SNMPAgent*>(std::__invoke_memfun_deref, void (SNMPAgent::*&&)(), SNMPAgent*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:73:14 (dnsdist+0xf36079) #11 std::__invoke_result<void (SNMPAgent::*)(), SNMPAgent*>::type std::__invoke<void (SNMPAgent::*)(), SNMPAgent*>(void (SNMPAgent::*&&)(), SNMPAgent*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/invoke.h:95:14 (dnsdist+0xf35f71) #12 decltype(std::__invoke(_S_declval<0ul>(), _S_declval<1ul>())) std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:244:13 (dnsdist+0xf35f1e) #13 std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:253:11 (dnsdist+0xf35ec5) #14 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SNMPAgent::*)(), SNMPAgent*> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/thread:196:13 (dnsdist+0xf35c29) #15 <null> <null> (libstdc++.so.6+0xbbb2e) Previous write of size 8 at 0x7b7400002580 by thread T18: [failed to restore the stack] Location is heap block of size 2304 at 0x7b7400001e00 allocated by main thread: #0 operator new(unsigned long, std::align_val_t) <null> (dnsdist+0x7e8c57) #1 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/ext/new_allocator.h:108:31 (dnsdist+0xe6b4e2) #2 std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/alloc_traits.h:436:20 (dnsdist+0xe6b430) #3 std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/allocated_ptr.h:97:21 (dnsdist+0xe6b1d0) #4 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<DownstreamState, std::allocator<DownstreamState>, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool>(DownstreamState*&, std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/shared_ptr_base.h:675:19 (dnsdist+0xe6fb0a) #5 std::__shared_ptr<DownstreamState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<DownstreamState>, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool>(std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/shared_ptr_base.h:1342:14 (dnsdist+0xe6fa7a) #6 std::shared_ptr<DownstreamState>::shared_ptr<std::allocator<DownstreamState>, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool>(std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/shared_ptr.h:359:4 (dnsdist+0xe6f99d) #7 std::shared_ptr<DownstreamState> std::allocate_shared<DownstreamState, std::allocator<DownstreamState>, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool>(std::allocator<DownstreamState> const&, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/shared_ptr.h:705:14 (dnsdist+0xe6f8e0) #8 std::shared_ptr<DownstreamState> std::make_shared<DownstreamState, ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool>(ComboAddress&, ComboAddress&, unsigned int&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned long&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/shared_ptr.h:721:14 (dnsdist+0xe6a726) #9 setupLuaConfig(LuaContext&, bool, bool)::$_2::operator()(boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>) const /opt/project/pdns/dnsdistdist/dnsdist-lua.cc:356:11 (dnsdist+0xdf9166) #10 _ZN10LuaContext6BinderIRZL14setupLuaConfigRS_bbE3$_2RKN5boost7variantINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEJSt13unordered_mapISB_NS5_IbJSB_St6vectorISt4pairIiSB_ESaISF_EESt8functionIFSt5tupleIJ7DNSNamettEERKSK_ttP9dnsheaderEEEEESt4hashISB_ESt8equal_toISB_ESaISE_IKSB_SS_EEEEEEEclIJRKNS4_8optionalIiEEEEEDTcldtdefpT8functiondtdefpT5paramspclsr3stdE7forwardIT_Efp_EEEDpOS1A_ /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1846:20 (dnsdist+0xdf89af) #11 _ZN10LuaContext6BinderIRNS0_IRZL14setupLuaConfigRS_bbE3$_2RKN5boost7variantINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEJSt13unordered_mapISB_NS5_IbJSB_St6vectorISt4pairIiSB_ESaISF_EESt8functionIFSt5tupleIJ7DNSNamettEERKSK_ttP9dnsheaderEEEEESt4hashISB_ESt8equal_toISB_ESaISE_IKSB_SS_EEEEEEEERKNS4_8optionalIiEEEclIJEEEDTcldtdefpT8functiondtdefpT5paramspclsr3stdE7forwardIT_Efp_EEEDpOS1C_ /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1846:20 (dnsdist+0xdf8917) #12 std::shared_ptr<DownstreamState> LuaContext::readIntoFunction<std::shared_ptr<DownstreamState>, LuaContext::Binder<LuaContext::Binder<setupLuaConfig(LuaContext&, bool, bool)::$_2&, boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > const&>&, boost::optional<int> const&>&>(lua_State*, LuaContext::tag<std::shared_ptr<DownstreamState> >, LuaContext::Binder<LuaContext::Binder<setupLuaConfig(LuaContext&, bool, bool)::$_2&, boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > const&>&, boost::optional<int> const&>&, int) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1766:16 (dnsdist+0xdf88be) #13 std::enable_if<IsOptional<boost::optional<int> >::value, std::shared_ptr<DownstreamState> >::type LuaContext::readIntoFunction<std::shared_ptr<DownstreamState>, LuaContext::Binder<setupLuaConfig(LuaContext&, bool, bool)::$_2&, boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > const&>&, boost::optional<int> >(lua_State*, LuaContext::tag<std::shared_ptr<DownstreamState> >, LuaContext::Binder<setupLuaConfig(LuaContext&, bool, bool)::$_2&, boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > const&>&, int, LuaContext::tag<boost::optional<int> >) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1774:20 (dnsdist+0xdf8624) #14 std::enable_if<!(IsOptional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > >::value), std::shared_ptr<DownstreamState> >::type LuaContext::readIntoFunction<std::shared_ptr<DownstreamState>, setupLuaConfig(LuaContext&, bool, bool)::$_2&, boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int> >(lua_State*, LuaContext::tag<std::shared_ptr<DownstreamState> >, setupLuaConfig(LuaContext&, bool, bool)::$_2&, int, LuaContext::tag<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > > >, LuaContext::tag<boost::optional<int> >) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1796:16 (dnsdist+0xdf848d) #15 std::enable_if<(!(std::integral_constant<bool, false>::value)) && (!(std::is_void<bool>::value)), LuaContext::PushedObject>::type LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::callback2<setupLuaConfig(LuaContext&, bool, bool)::$_2&>(lua_State*, bool&&, int) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2429:31 (dnsdist+0xdf83c2) #16 LuaContext::PushedObject LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::callback<setupLuaConfig(LuaContext&, bool, bool)::$_2>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_2*, int) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2398:20 (dnsdist+0xdf8169) #17 std::enable_if<boost::has_trivial_destructor<setupLuaConfig(LuaContext&, bool, bool)::$_2>::value, LuaContext::PushedObject>::type LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::push<setupLuaConfig(LuaContext&, bool, bool)::$_2>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_2)::'lambda'(lua_State*)::operator()(lua_State*) const /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2327:20 (dnsdist+0xdf80c9) #18 std::enable_if<boost::has_trivial_destructor<setupLuaConfig(LuaContext&, bool, bool)::$_2>::value, LuaContext::PushedObject>::type LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::push<setupLuaConfig(LuaContext&, bool, bool)::$_2>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_2)::'lambda'(lua_State*)::__invoke(lua_State*) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2323:31 (dnsdist+0xdf8055) #19 _init <null> (libluajit-5.1.so.2+0x9dd6) #20 std::tuple<> LuaContext::call<std::tuple<> >(lua_State*, LuaContext::PushedObject) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1413:29 (dnsdist+0xc9ae67) #21 LuaContext::executeCode(std::istream&) /opt/project/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:267:9 (dnsdist+0xe6077a) #22 setupLua(LuaContext&, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /opt/project/pdns/dnsdistdist/dnsdist-lua.cc:2599:10 (dnsdist+0xdf4ff3) #23 main /opt/project/pdns/dnsdistdist/dnsdist.cc:2235:17 (dnsdist+0xf282ea) Thread T2 'dnsdist/SNMP' (tid=11160, running) created by main thread at: #0 pthread_create <null> (dnsdist+0x75f2d5) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xbbdb4) #2 SNMPAgent::run() /opt/project/pdns/dnsdistdist/./snmp-agent.hh:36:14 (dnsdist+0xf3087c) #3 main /opt/project/pdns/dnsdistdist/dnsdist.cc:2373:20 (dnsdist+0xf28f32) Thread T18 'dnsdist/healthC' (tid=11176, running) created by main thread at: #0 pthread_create <null> (dnsdist+0x75f2d5) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xbbdb4) #2 main /opt/project/pdns/dnsdistdist/dnsdist.cc:2463:12 (dnsdist+0xf29769) SUMMARY: ThreadSanitizer: data race (/opt/dnsdist-with-tsan/bin/dnsdist+0x7a6eb0) in __tsan_atomic64_load ```
Habbie
pushed a commit
that referenced
this pull request
Mar 16, 2023
The IO error was not always handled by the proper TCP thread, possibly leading to a race condition where two TCP worker threads were touching the same TCP connection object at the same time. Technically the issue also exists for XFR responses, but these are very unlikely to cross protocols. We are still applying the same fix. The issue was introduced in 516a000. This was reported by Thread Sanitizer: ``` 2023-03-10T13:52:59.5959261Z WARNING: ThreadSanitizer: data race (pid=15423) 2023-03-10T13:52:59.5959559Z Read of size 1 at 0x7b040000385c by thread T2 (mutexes: write M188): 2023-03-10T13:52:59.5960220Z #0 IOStateHandler::isWaitingForRead() const /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:41:12 (dnsdist+0x2e2978) 2023-03-10T13:52:59.5961073Z #1 IOStateHandler::update(IOState, std::function<void (int, boost::any&)>, boost::any, boost::optional<timeval>) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:109:9 (dnsdist+0x2e2978) 2023-03-10T13:52:59.5961812Z #2 IOStateHandler::reset() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:59:5 (dnsdist+0x2ea4c6) 2023-03-10T13:52:59.5962451Z #3 IOStateHandler::reset() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:59:5 (dnsdist+0x2ea4c6) 2023-03-10T13:52:59.5963106Z #4 IOStateHandler::~IOStateHandler() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:31:7 (dnsdist+0x2ea2a4) 2023-03-10T13:52:59.5980185Z #5 std::default_delete<IOStateHandler>::operator()(IOStateHandler*) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:85:2 (dnsdist+0x2ea2a4) 2023-03-10T13:52:59.5981308Z #6 std::__uniq_ptr_impl<IOStateHandler, std::default_delete<IOStateHandler> >::reset(IOStateHandler*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:182:4 (dnsdist+0x2ea0c3) 2023-03-10T13:52:59.5982163Z #7 std::__uniq_ptr_impl<IOStateHandler, std::default_delete<IOStateHandler> >::reset(IOStateHandler*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:182:4 (dnsdist+0x2ea0c3) 2023-03-10T13:52:59.5983209Z #8 std::unique_ptr<IOStateHandler, std::default_delete<IOStateHandler> >::reset(IOStateHandler*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:456:7 (dnsdist+0xb1eb8a) 2023-03-10T13:52:59.5984893Z #9 IncomingTCPConnectionState::terminateClientConnection() /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:384:13 (dnsdist+0xb1eb8a) 2023-03-10T13:52:59.5985685Z #10 IncomingTCPConnectionState::notifyIOError(InternalQueryState&&, timeval const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1111:12 (dnsdist+0xb29b13) 2023-03-10T13:52:59.5989279Z #11 IncomingTCPConnectionState::notifyIOError(InternalQueryState&&, timeval const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1111:12 (dnsdist+0xb29b13) 2023-03-10T13:52:59.5990754Z #12 dnsdist_ffi_drop_from_async /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-ffi.cc:931:11 (dnsdist+0x816ac7) 2023-03-10T13:52:59.5991305Z #13 <null> <null> (0x7f3d3ad7fca3) 2023-03-10T13:52:59.5992209Z #14 void LuaContext::call<void, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(lua_State*, LuaContext::PushedObject, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1413:29 (dnsdist+0x5b31b5) 2023-03-10T13:52:59.5993583Z #15 LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1983:16 (dnsdist+0x5b31b5) 2023-03-10T13:52:59.5998774Z #16 void std::__invoke_impl<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__invoke_other, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6002652Z #17 std::enable_if<is_invocable_r_v<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, void>::type std::__invoke_r<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6006264Z #18 std::_Function_handler<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >::_M_invoke(std::_Any_data const&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6011711Z #19 void std::__invoke_impl<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__invoke_other, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6015474Z #20 std::enable_if<is_invocable_r_v<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, void>::type std::__invoke_r<void, LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6021250Z #21 std::_Function_handler<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), LuaContext::LuaFunctionCaller<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)> >::_M_invoke(std::_Any_data const&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x5b2b24) 2023-03-10T13:52:59.6023199Z #22 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x5b4099) 2023-03-10T13:52:59.6024946Z #23 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x5b4099) 2023-03-10T13:52:59.6031647Z #24 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x5b4099) 2023-03-10T13:52:59.6034121Z #25 setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-bindings-network.cc:73:9 (dnsdist+0x5b3f99) 2023-03-10T13:52:59.6041186Z #26 void std::__invoke_impl<void, setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(std::__invoke_other, setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x5b3df8) 2023-03-10T13:52:59.6053139Z #27 std::enable_if<is_invocable_r_v<void, setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, void>::type std::__invoke_r<void, setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&, unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>(setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x5b3df8) 2023-03-10T13:52:59.6061003Z #28 std::_Function_handler<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&), setupLuaBindingsNetwork(LuaContext&, bool)::$_4::operator()(std::shared_ptr<dnsdist::NetworkListener>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned short, std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>) const::'lambda'(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::_M_invoke(std::_Any_data const&, unsigned short&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x5b3df8) 2023-03-10T13:52:59.6068262Z #29 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x8cad59) 2023-03-10T13:52:59.6070197Z #30 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x8cad59) 2023-03-10T13:52:59.6071860Z #31 std::function<void (unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>::operator()(unsigned short, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0x8cad59) 2023-03-10T13:52:59.6072883Z #32 dnsdist::NetworkListener::readCB(int, boost::any&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:64:7 (dnsdist+0x8ca9e6) 2023-03-10T13:52:59.6076346Z #33 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x2efbf3) 2023-03-10T13:52:59.6077403Z #34 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x2efb12) 2023-03-10T13:52:59.6078361Z #35 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x2ef949) 2023-03-10T13:52:59.6079161Z #36 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0xc14f6c) 2023-03-10T13:52:59.6079696Z #37 EpollFDMultiplexer::run(timeval*, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/epollmplexer.cc:190:9 (dnsdist+0xc4fc84) 2023-03-10T13:52:59.6080417Z #38 dnsdist::NetworkListener::runOnce(timeval&, unsigned int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:130:14 (dnsdist+0x8cba17) 2023-03-10T13:52:59.6081121Z #39 dnsdist::NetworkListener::mainThread() /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:139:5 (dnsdist+0x8cba17) 2023-03-10T13:52:59.6081918Z #40 dnsdist::NetworkListener::start()::$_0::operator()() const /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:146:5 (dnsdist+0x8cdffd) 2023-03-10T13:52:59.6089376Z #41 dnsdist::NetworkListener::start()::$_0::operator()() const /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:146:5 (dnsdist+0x8cdffd) 2023-03-10T13:52:59.6090276Z #42 void std::__invoke_impl<void, dnsdist::NetworkListener::start()::$_0>(std::__invoke_other, dnsdist::NetworkListener::start()::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x8cdfc5) 2023-03-10T13:52:59.6091963Z #43 std::__invoke_result<dnsdist::NetworkListener::start()::$_0>::type std::__invoke<dnsdist::NetworkListener::start()::$_0>(dnsdist::NetworkListener::start()::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0x8cdf95) 2023-03-10T13:52:59.6093040Z #44 void std::thread::_Invoker<std::tuple<dnsdist::NetworkListener::start()::$_0> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0x8cdf6c) 2023-03-10T13:52:59.6096527Z #45 std::thread::_Invoker<std::tuple<dnsdist::NetworkListener::start()::$_0> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0x8cdef5) 2023-03-10T13:52:59.6097439Z #46 std::thread::_State_impl<std::thread::_Invoker<std::tuple<dnsdist::NetworkListener::start()::$_0> > >::_M_run() (.llvm.6599844077253043448) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0x8cde39) 2023-03-10T13:52:59.6097887Z #47 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6098058Z 2023-03-10T13:52:59.6098203Z Previous write of size 1 at 0x7b040000385c by thread T8: 2023-03-10T13:52:59.6098928Z #0 IOStateHandler::update(IOState, std::function<void (int, boost::any&)>, boost::any, boost::optional<timeval>) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./tcpiohandler-mplexer.hh:112:26 (dnsdist+0x2e29b1) 2023-03-10T13:52:59.6099813Z #1 IncomingTCPConnectionState::handleIO(std::shared_ptr<IncomingTCPConnectionState>&, timeval const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1075:25 (dnsdist+0xb23c18) 2023-03-10T13:52:59.6100613Z #2 IncomingTCPConnectionState::handleIOCallback(int, boost::any&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:827:3 (dnsdist+0xb246dd) 2023-03-10T13:52:59.6101492Z #3 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x2efbf3) 2023-03-10T13:52:59.6102502Z #4 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x2efb12) 2023-03-10T13:52:59.6103665Z #5 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x2ef949) 2023-03-10T13:52:59.6104464Z #6 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0xc14f6c) 2023-03-10T13:52:59.6105005Z #7 EpollFDMultiplexer::run(timeval*, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/epollmplexer.cc:190:9 (dnsdist+0xc4fc84) 2023-03-10T13:52:59.6105772Z #8 tcpClientThread(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1318:21 (dnsdist+0xb1c132) 2023-03-10T13:52:59.6107243Z #9 void std::__invoke_impl<void, void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int&&, int&&, int&&, int&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0xb3d4d7) 2023-03-10T13:52:59.6109241Z #10 std::__invoke_result<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int&&, int&&, int&&, int&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6110879Z #11 void std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6112054Z #12 std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6113226Z #13 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6113778Z #14 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6114055Z #15 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6114324Z #16 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6114574Z #17 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6114728Z 2023-03-10T13:52:59.6114889Z Location is heap block of size 16 at 0x7b0400003850 allocated by thread T8: 2023-03-10T13:52:59.6115222Z #0 operator new(unsigned long) <null> (dnsdist+0x184e96) 2023-03-10T13:52:59.6115982Z #1 std::_MakeUniq<IOStateHandler>::__single_object std::make_unique<IOStateHandler, FDMultiplexer&, int&>(FDMultiplexer&, int&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:962:30 (dnsdist+0xb343bf) 2023-03-10T13:52:59.6116940Z #2 IncomingTCPConnectionState::IncomingTCPConnectionState(ConnectionInfo&&, TCPClientThreadData&, timeval const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./dnsdist-tcp-upstream.hh:24:338 (dnsdist+0xb343bf) 2023-03-10T13:52:59.6118177Z #3 void __gnu_cxx::new_allocator<IncomingTCPConnectionState>::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/new_allocator.h:150:23 (dnsdist+0xb33938) 2023-03-10T13:52:59.6119719Z #4 void std::allocator_traits<std::allocator<IncomingTCPConnectionState> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:512:8 (dnsdist+0xb33938) 2023-03-10T13:52:59.6121161Z #5 void __gnu_cxx::new_allocator<IncomingTCPConnectionState>::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/new_allocator.h:150:23 (dnsdist+0xb33938) 2023-03-10T13:52:59.6122645Z #6 void std::allocator_traits<std::allocator<IncomingTCPConnectionState> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:512:8 (dnsdist+0xb33938) 2023-03-10T13:52:59.6124511Z #7 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:551:4 (dnsdist+0xb335b1) 2023-03-10T13:52:59.6126190Z #8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:683:6 (dnsdist+0xb335b1) 2023-03-10T13:52:59.6127835Z #9 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:551:4 (dnsdist+0xb335b1) 2023-03-10T13:52:59.6129495Z #10 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:683:6 (dnsdist+0xb335b1) 2023-03-10T13:52:59.6131136Z #11 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1371:14 (dnsdist+0xb33357) 2023-03-10T13:52:59.6132660Z #12 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:408:4 (dnsdist+0xb33357) 2023-03-10T13:52:59.6134205Z #13 std::shared_ptr<IncomingTCPConnectionState> std::allocate_shared<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState> const&, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:859:14 (dnsdist+0xb33357) 2023-03-10T13:52:59.6135927Z #14 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1371:14 (dnsdist+0xb33357) 2023-03-10T13:52:59.6137427Z #15 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<IncomingTCPConnectionState> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:408:4 (dnsdist+0xb33357) 2023-03-10T13:52:59.6139010Z #16 std::shared_ptr<IncomingTCPConnectionState> std::allocate_shared<IncomingTCPConnectionState, std::allocator<IncomingTCPConnectionState>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<IncomingTCPConnectionState> const&, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:859:14 (dnsdist+0xb33357) 2023-03-10T13:52:59.6140360Z #17 std::shared_ptr<IncomingTCPConnectionState> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:875:14 (dnsdist+0xb3323c) 2023-03-10T13:52:59.6141560Z #18 std::shared_ptr<IncomingTCPConnectionState> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:875:14 (dnsdist+0xb3323c) 2023-03-10T13:52:59.6142764Z #19 std::shared_ptr<IncomingTCPConnectionState> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:875:14 (dnsdist+0xb3323c) 2023-03-10T13:52:59.6143631Z #20 handleIncomingTCPQuery(int, boost::any&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1164:18 (dnsdist+0xb30c93) 2023-03-10T13:52:59.6144480Z #21 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x2efbf3) 2023-03-10T13:52:59.6145171Z #22 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2 (dnsdist+0x2efb12) 2023-03-10T13:52:59.6145727Z #23 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9 (dnsdist+0x2ef949) 2023-03-10T13:52:59.6146188Z #24 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14 (dnsdist+0xc14f6c) 2023-03-10T13:52:59.6146441Z #25 EpollFDMultiplexer::run(timeval*, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/epollmplexer.cc:190:9 (dnsdist+0xc4fc84) 2023-03-10T13:52:59.6146930Z #26 tcpClientThread(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1318:21 (dnsdist+0xb1c132) 2023-03-10T13:52:59.6148031Z #27 void std::__invoke_impl<void, void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int&&, int&&, int&&, int&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0xb3d4d7) 2023-03-10T13:52:59.6149371Z #28 std::__invoke_result<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int&&, int&&, int&&, int&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6150265Z #29 void std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6150973Z #30 std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6151745Z #31 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> >), int, int, int, int, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0xb3c6a2) 2023-03-10T13:52:59.6151858Z #32 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6151978Z #33 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6152094Z #34 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6152209Z #35 <null> <null> (libstdc++.so.6+0xda6b3) 2023-03-10T13:52:59.6152216Z 2023-03-10T13:52:59.6152326Z Mutex M188 (0x55807ad82020) created at: 2023-03-10T13:52:59.6152457Z #0 pthread_mutex_lock <null> (dnsdist+0x111876) 2023-03-10T13:52:59.6152906Z #1 __gthread_mutex_lock(pthread_mutex_t*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/gthr-default.h:749:12 (dnsdist+0x1af1df) 2023-03-10T13:52:59.6153271Z #2 std::mutex::lock() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_mutex.h:100:17 (dnsdist+0x1af1df) 2023-03-10T13:52:59.6153688Z #3 std::lock_guard<std::mutex>::lock_guard(std::mutex&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_mutex.h:159:19 (dnsdist+0x2635f9) 2023-03-10T13:52:59.6153984Z #4 LockGuardedHolder<LuaContext>::LockGuardedHolder(LuaContext&, std::mutex&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./lock.hh:209:60 (dnsdist+0x2635f9) 2023-03-10T13:52:59.6154404Z #5 std::lock_guard<std::mutex>::lock_guard(std::mutex&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_mutex.h:159:19 (dnsdist+0x2635f9) 2023-03-10T13:52:59.6154677Z #6 LockGuardedHolder<LuaContext>::LockGuardedHolder(LuaContext&, std::mutex&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./lock.hh:209:60 (dnsdist+0x2635f9) 2023-03-10T13:52:59.6154906Z #7 LockGuarded<LuaContext>::lock() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./lock.hh:289:12 (dnsdist+0x25b372) 2023-03-10T13:52:59.6155196Z #8 LockGuarded<LuaContext>::lock() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./lock.hh:289:12 (dnsdist+0x25b372) 2023-03-10T13:52:59.6155387Z #9 main /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2667:34 (dnsdist+0xb93565) 2023-03-10T13:52:59.6155395Z 2023-03-10T13:52:59.6155663Z Thread T2 'dnsdist/lua-net' (tid=15426, running) created by main thread at: 2023-03-10T13:52:59.6155789Z #0 pthread_create <null> (dnsdist+0xf3acb) 2023-03-10T13:52:59.6156049Z #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xda989) 2023-03-10T13:52:59.6156439Z #2 dnsdist::NetworkListener::start() /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-network.cc:145:22 (dnsdist+0x8cbae1) 2023-03-10T13:52:59.6157087Z #3 setupLuaBindingsNetwork(LuaContext&, bool)::$_6::operator()(std::shared_ptr<dnsdist::NetworkListener>&) const /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua-bindings-network.cc:100:15 (dnsdist+0x5bbf4f) 2023-03-10T13:52:59.6157529Z #4 decltype(*(this).function(*(this).param)) LuaContext::Binder<setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, std::shared_ptr<dnsdist::NetworkListener>&>::operator()<>() /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1853:20 (dnsdist+0x5bbebb) 2023-03-10T13:52:59.6158131Z #5 void LuaContext::readIntoFunction<void, LuaContext::Binder<setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, std::shared_ptr<dnsdist::NetworkListener>&>&>(lua_State*, LuaContext::tag<void>, LuaContext::Binder<setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, std::shared_ptr<dnsdist::NetworkListener>&>&, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1772:16 (dnsdist+0x5bbebb) 2023-03-10T13:52:59.6158816Z #6 std::enable_if<!(IsOptional<std::shared_ptr<dnsdist::NetworkListener>&>::value), void>::type LuaContext::readIntoFunction<void, setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, std::shared_ptr<dnsdist::NetworkListener>&>(lua_State*, LuaContext::tag<void>, setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, int, LuaContext::tag<std::shared_ptr<dnsdist::NetworkListener>&>) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1803:16 (dnsdist+0x5bbd55) 2023-03-10T13:52:59.6159489Z #7 std::enable_if<!(IsOptional<std::shared_ptr<dnsdist::NetworkListener>&>::value), void>::type LuaContext::readIntoFunction<void, setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, std::shared_ptr<dnsdist::NetworkListener>&>(lua_State*, LuaContext::tag<void>, setupLuaBindingsNetwork(LuaContext&, bool)::$_6&, int, LuaContext::tag<std::shared_ptr<dnsdist::NetworkListener>&>) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1803:16 (dnsdist+0x5bbd55) 2023-03-10T13:52:59.6160072Z #8 std::enable_if<(std::integral_constant<bool, true>::value) && (!(std::is_void<bool>::value)), LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<dnsdist::NetworkListener>&), void>::callback2<setupLuaBindingsNetwork(LuaContext&, bool)::$_6&>(lua_State*, bool&&, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2443:9 (dnsdist+0x5bbc62) 2023-03-10T13:52:59.6160587Z #9 LuaContext::PushedObject LuaContext::Pusher<void (std::shared_ptr<dnsdist::NetworkListener>&), void>::callback<setupLuaBindingsNetwork(LuaContext&, bool)::$_6>(lua_State*, setupLuaBindingsNetwork(LuaContext&, bool)::$_6*, int) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2405:20 (dnsdist+0x5bb999) 2023-03-10T13:52:59.6161776Z #10 std::enable_if<boost::has_trivial_destructor<setupLuaBindingsNetwork(LuaContext&, bool)::$_6>::value, LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<dnsdist::NetworkListener>&), void>::push<setupLuaBindingsNetwork(LuaContext&, bool)::$_6>(lua_State*, setupLuaBindingsNetwork(LuaContext&, bool)::$_6)::'lambda'(lua_State*)::operator()(lua_State*) const /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2334:20 (dnsdist+0x5bb8c7) 2023-03-10T13:52:59.6162870Z #11 std::enable_if<boost::has_trivial_destructor<setupLuaBindingsNetwork(LuaContext&, bool)::$_6>::value, LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<dnsdist::NetworkListener>&), void>::push<setupLuaBindingsNetwork(LuaContext&, bool)::$_6>(lua_State*, setupLuaBindingsNetwork(LuaContext&, bool)::$_6)::'lambda'(lua_State*)::__invoke(lua_State*) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2330:31 (dnsdist+0x5bb8c7) 2023-03-10T13:52:59.6163072Z #12 <null> <null> (libluajit-5.1.so.2+0x8fb6) 2023-03-10T13:52:59.6163265Z #13 <null> <null> (libluajit-5.1.so.2+0x8fb6) 2023-03-10T13:52:59.6163654Z #14 std::tuple<> LuaContext::call<std::tuple<> >(lua_State*, LuaContext::PushedObject) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1413:29 (dnsdist+0x81d979) 2023-03-10T13:52:59.6164106Z #15 LuaContext::executeCode(std::istream&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:267:9 (dnsdist+0x999ddf) 2023-03-10T13:52:59.6164650Z #16 setupLua(LuaContext&, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-lua.cc:3022:10 (dnsdist+0x98ecf3) 2023-03-10T13:52:59.6164844Z #17 main /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2667:17 (dnsdist+0xb935a4) 2023-03-10T13:52:59.6164852Z 2023-03-10T13:52:59.6165108Z Thread T8 'dnsdist/tcpClie' (tid=15432, running) created by main thread at: 2023-03-10T13:52:59.6165219Z #0 pthread_create <null> (dnsdist+0xf3acb) 2023-03-10T13:52:59.6165479Z #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xda989) 2023-03-10T13:52:59.6166034Z #2 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126:5 (dnsdist+0xb1a91a) 2023-03-10T13:52:59.6166576Z #3 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126:5 (dnsdist+0xb1a91a) 2023-03-10T13:52:59.6167392Z #4 std::_MakeUniq<TCPClientCollection>::__single_object std::make_unique<TCPClientCollection, unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> > >(unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:962:34 (dnsdist+0xb962aa) 2023-03-10T13:52:59.6167587Z #5 main /home/runner/work/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2834:26 (dnsdist+0xb962aa) 2023-03-10T13:52:59.6167715Z #6 __libc_start_main <null> (libc.so.6+0x24082) 2023-03-10T13:52:59.6167841Z #7 __libc_start_main <null> (libc.so.6+0x24082) ```
Habbie
pushed a commit
that referenced
this pull request
Mar 17, 2023
When `svc-autohints` is enabled, the content of SVCB and HTTPS records is modified in `PacketHandler::doAdditionalProcessing()` to expand the IPv4 and IPv6 with their actual values. This causes an issue because the content of these records might be shared between threads, via the record cache, and one thread could be trying to read from the internal `std::set` while a second thread is altering it, leading to a data race and possibly to memory corruption and a crash. This is correctly detected by TSAN: ``` WARNING: ThreadSanitizer: data race (pid=102795) Write of size 8 at 0x7b3400010350 by thread T33: #0 operator delete(void*) <null> (pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 std::__new_allocator<std::_Rb_tree_node<SvcParam>>::deallocate(std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/new_allocator.h:158:2 (pdns_server+0x33fc78) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #2 std::allocator_traits<std::allocator<std::_Rb_tree_node<SvcParam>>>::deallocate(std::allocator<std::_Rb_tree_node<SvcParam>>&, std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/alloc_traits.h:496:13 (pdns_server+0x33fc78) #3 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_put_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:565:9 (pdns_server+0x33fc78) #4 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_drop_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:632:2 (pdns_server+0x33fc78) #5 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_erase_aux(std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:2495:7 (pdns_server+0x33fc78) #6 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:1197:2 (pdns_server+0x33fc78) #7 std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_set.h:655:21 (pdns_server+0x33fc78) #8 SVCBBaseRecordContent::setHints(SvcParam::SvcParamKey const&, std::vector<ComboAddress, std::allocator<ComboAddress>> const&) /work/pdns/pdns/dnsrecords.cc:768:14 (pdns_server+0x33fc78) #9 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:565:16 (pdns_server+0x4ed330) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #11 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #12 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #13 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #14 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) #15 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) #16 void std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) #17 std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) #18 std::thread::_State_impl<std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) #19 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Previous read of size 2 at 0x7b3400010350 by thread T39: #0 SvcParam::getKey() const /work/pdns/pdns/./svc-records.hh:80:12 (pdns_server+0x3721f3) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>::xfrSvcParamKeyVals(std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>> const&) /work/pdns/pdns/dnswriter.cc:404:23 (pdns_server+0x3721f3) #2 void HTTPSRecordContent::xfrPacket<GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>>(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&, bool) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #3 HTTPSRecordContent::toPacket(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) #4 DNSRecordContent::serialize[abi:cxx11](DNSName const&, bool, bool) /work/pdns/pdns/./dnsparser.hh:215:11 (pdns_server+0x311140) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #5 DNSPacket::addRecord(DNSZoneRecord&&) /work/pdns/pdns/dnspacket.cc:177:68 (pdns_server+0x2fa894) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:542:8 (pdns_server+0x4eccf2) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #7 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #8 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #9 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #11 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) #12 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) #13 void std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) #14 std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) #16 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T33 'pdns/distributo' (tid=102833, running) created by thread T17 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T39 'pdns/distributo' (tid=102837, running) created by thread T19 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) SUMMARY: ThreadSanitizer: data race (/work/pdns-rgacogne/pdns/pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) in operator delete(void*) ``` To prevent this issue, this commit wraps the internal `std::set` in a mutex. In theory this will cause a performance impact, but in practice I did not find it to be noticeable. If we ever do, a different solution would be to duplicate the content of the SVCB/HTTPS records before modifying them.
Habbie
pushed a commit
that referenced
this pull request
Mar 23, 2023
When `svc-autohints` is enabled, the content of SVCB and HTTPS records is modified in `PacketHandler::doAdditionalProcessing()` to expand the IPv4 and IPv6 with their actual values. This causes an issue because the content of these records might be shared between threads, via the record cache, and one thread could be trying to read from the internal `std::set` while a second thread is altering it, leading to a data race and possibly to memory corruption and a crash. This is correctly detected by TSAN: ``` WARNING: ThreadSanitizer: data race (pid=102795) Write of size 8 at 0x7b3400010350 by thread T33: #0 operator delete(void*) <null> (pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 std::__new_allocator<std::_Rb_tree_node<SvcParam>>::deallocate(std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/new_allocator.h:158:2 (pdns_server+0x33fc78) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #2 std::allocator_traits<std::allocator<std::_Rb_tree_node<SvcParam>>>::deallocate(std::allocator<std::_Rb_tree_node<SvcParam>>&, std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/alloc_traits.h:496:13 (pdns_server+0x33fc78) #3 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_put_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:565:9 (pdns_server+0x33fc78) #4 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_drop_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:632:2 (pdns_server+0x33fc78) #5 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_erase_aux(std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:2495:7 (pdns_server+0x33fc78) #6 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:1197:2 (pdns_server+0x33fc78) #7 std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_set.h:655:21 (pdns_server+0x33fc78) #8 SVCBBaseRecordContent::setHints(SvcParam::SvcParamKey const&, std::vector<ComboAddress, std::allocator<ComboAddress>> const&) /work/pdns/pdns/dnsrecords.cc:768:14 (pdns_server+0x33fc78) #9 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:565:16 (pdns_server+0x4ed330) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) PowerDNS#11 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) PowerDNS#12 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) PowerDNS#13 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) PowerDNS#14 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) PowerDNS#15 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) PowerDNS#16 void std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) PowerDNS#17 std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) PowerDNS#18 std:thread:_State_impl<std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) PowerDNS#19 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Previous read of size 2 at 0x7b3400010350 by thread T39: #0 SvcParam::getKey() const /work/pdns/pdns/./svc-records.hh:80:12 (pdns_server+0x3721f3) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>::xfrSvcParamKeyVals(std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>> const&) /work/pdns/pdns/dnswriter.cc:404:23 (pdns_server+0x3721f3) #2 void HTTPSRecordContent::xfrPacket<GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>>(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&, bool) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #3 HTTPSRecordContent::toPacket(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) #4 DNSRecordContent::serialize[abi:cxx11](DNSName const&, bool, bool) /work/pdns/pdns/./dnsparser.hh:215:11 (pdns_server+0x311140) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #5 DNSPacket::addRecord(DNSZoneRecord&&) /work/pdns/pdns/dnspacket.cc:177:68 (pdns_server+0x2fa894) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:542:8 (pdns_server+0x4eccf2) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #7 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #8 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #9 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) PowerDNS#11 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) PowerDNS#12 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) PowerDNS#13 void std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) PowerDNS#14 std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) PowerDNS#15 std:thread:_State_impl<std:thread:_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) PowerDNS#16 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T33 'pdns/distributo' (tid=102833, running) created by thread T17 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std:thread:_M_start_thread(std::unique_ptr<std:thread:_State, std::default_delete<std:thread:_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std:thread:_State_impl<std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T39 'pdns/distributo' (tid=102837, running) created by thread T19 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std:thread:_M_start_thread(std::unique_ptr<std:thread:_State, std::default_delete<std:thread:_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std:thread:_State_impl<std:thread:_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) SUMMARY: ThreadSanitizer: data race (/work/pdns-rgacogne/pdns/pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) in operator delete(void*) ``` To prevent this issue, this commit clones the content of SVCB/HTTPS records before modifying the copy. the drawback is that we need to do this operation every single time we process them.
Habbie
pushed a commit
that referenced
this pull request
Apr 13, 2023
When `svc-autohints` is enabled, the content of SVCB and HTTPS records is modified in `PacketHandler::doAdditionalProcessing()` to expand the IPv4 and IPv6 with their actual values. This causes an issue because the content of these records might be shared between threads, via the record cache, and one thread could be trying to read from the internal `std::set` while a second thread is altering it, leading to a data race and possibly to memory corruption and a crash. This is correctly detected by TSAN: ``` WARNING: ThreadSanitizer: data race (pid=102795) Write of size 8 at 0x7b3400010350 by thread T33: #0 operator delete(void*) <null> (pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 std::__new_allocator<std::_Rb_tree_node<SvcParam>>::deallocate(std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/new_allocator.h:158:2 (pdns_server+0x33fc78) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #2 std::allocator_traits<std::allocator<std::_Rb_tree_node<SvcParam>>>::deallocate(std::allocator<std::_Rb_tree_node<SvcParam>>&, std::_Rb_tree_node<SvcParam>*, unsigned long) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/alloc_traits.h:496:13 (pdns_server+0x33fc78) #3 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_put_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:565:9 (pdns_server+0x33fc78) #4 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_drop_node(std::_Rb_tree_node<SvcParam>*) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:632:2 (pdns_server+0x33fc78) #5 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::_M_erase_aux(std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:2495:7 (pdns_server+0x33fc78) #6 std::_Rb_tree<SvcParam, SvcParam, std::_Identity<SvcParam>, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_tree.h:1197:2 (pdns_server+0x33fc78) #7 std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>>::erase[abi:cxx11](std::_Rb_tree_const_iterator<SvcParam>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/stl_set.h:655:21 (pdns_server+0x33fc78) #8 SVCBBaseRecordContent::setHints(SvcParam::SvcParamKey const&, std::vector<ComboAddress, std::allocator<ComboAddress>> const&) /work/pdns/pdns/dnsrecords.cc:768:14 (pdns_server+0x33fc78) #9 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:565:16 (pdns_server+0x4ed330) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #11 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #12 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #13 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #14 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) #15 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) #16 void std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) #17 std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) #18 std::thread::_State_impl<std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) #19 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Previous read of size 2 at 0x7b3400010350 by thread T39: #0 SvcParam::getKey() const /work/pdns/pdns/./svc-records.hh:80:12 (pdns_server+0x3721f3) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>::xfrSvcParamKeyVals(std::set<SvcParam, std::less<SvcParam>, std::allocator<SvcParam>> const&) /work/pdns/pdns/dnswriter.cc:404:23 (pdns_server+0x3721f3) #2 void HTTPSRecordContent::xfrPacket<GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>>(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&, bool) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #3 HTTPSRecordContent::toPacket(GenericDNSPacketWriter<std::vector<unsigned char, std::allocator<unsigned char>>>&) /work/pdns/pdns/dnsrecords.cc:348:1 (pdns_server+0x3349bd) #4 DNSRecordContent::serialize[abi:cxx11](DNSName const&, bool, bool) /work/pdns/pdns/./dnsparser.hh:215:11 (pdns_server+0x311140) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #5 DNSPacket::addRecord(DNSZoneRecord&&) /work/pdns/pdns/dnspacket.cc:177:68 (pdns_server+0x2fa894) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 PacketHandler::doAdditionalProcessing(DNSPacket&, std::unique_ptr<DNSPacket, std::default_delete<DNSPacket>>&) /work/pdns/pdns/packethandler.cc:542:8 (pdns_server+0x4eccf2) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #7 PacketHandler::doQuestion(DNSPacket&) /work/pdns/pdns/packethandler.cc:1794:5 (pdns_server+0x4f79b4) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #8 PacketHandler::question(DNSPacket&) /work/pdns/pdns/packethandler.cc:1175:10 (pdns_server+0x4f649a) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #9 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::distribute(int) /work/pdns/pdns/./distributor.hh:220:14 (pdns_server+0x260f70) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #10 MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()::operator()() const /work/pdns/pdns/./distributor.hh:179:25 (pdns_server+0x260b31) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #11 void std::__invoke_impl<void, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(std::__invoke_other, MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x260b31) #12 std::__invoke_result<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>::type std::__invoke<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>(MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x260b31) #13 void std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x260b31) #14 std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x260b31) #15 std::thread::_State_impl<std::thread::_Invoker<std::tuple<MultiThreadDistributor<DNSPacket, DNSPacket, PacketHandler>::MultiThreadDistributor(int)::'lambda'()>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x260b31) #16 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T33 'pdns/distributo' (tid=102833, running) created by thread T17 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) Thread T39 'pdns/distributo' (tid=102837, running) created by thread T19 at: #0 pthread_create <null> (pdns_server+0x1904e6) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663:35 (libstdc++.so.6+0xd73a9) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:147:37 (libstdc++.so.6+0xd73a9) #3 Distributor<DNSPacket, DNSPacket, PacketHandler>::Create(int) /work/pdns/pdns/./distributor.hh:134:18 (pdns_server+0x256d23) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #4 qthread(unsigned int) /work/pdns/pdns/auth-main.cc:536:25 (pdns_server+0x256d23) #5 void std::__invoke_impl<void, void (*)(unsigned int), unsigned int>(std::__invoke_other, void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:61:14 (pdns_server+0x2635f0) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) #6 std::__invoke_result<void (*)(unsigned int), unsigned int>::type std::__invoke<void (*)(unsigned int), unsigned int>(void (*&&)(unsigned int), unsigned int&&) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/invoke.h:96:14 (pdns_server+0x2635f0) #7 void std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:258:13 (pdns_server+0x2635f0) #8 std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>::operator()() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:265:11 (pdns_server+0x2635f0) #9 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(unsigned int), unsigned int>>>::_M_run() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/bits/std_thread.h:210:13 (pdns_server+0x2635f0) #10 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:82:18 (libstdc++.so.6+0xd72c2) (BuildId: 6fe66a2d539a78c993bd2d377e00fad389220963) SUMMARY: ThreadSanitizer: data race (/work/pdns-rgacogne/pdns/pdns_server+0x211b7c) (BuildId: 384adc19a67695435bd5e89d0a77f562561f4593) in operator delete(void*) ``` To prevent this issue, this commit wraps the internal `std::set` in a mutex. In theory this will cause a performance impact, but in practice I did not find it to be noticeable. If we ever do, a different solution would be to duplicate the content of the SVCB/HTTPS records before modifying them. (cherry picked from commit 18d5647)
Habbie
pushed a commit
that referenced
this pull request
May 16, 2023
…mode There is an actual race when one thread, likely the console, changes the health-check mode of a given backend just when the health-check thread is determining whether it should send a health-check probe. We are fine with getting a wrong value in the health-check thread, as long as we eventually get the new one, so let's not worry about it and add a TSAN suppression. The TSAN report was: ``` WARNING: ThreadSanitizer: data race (pid=5301) Read of size 1 at 0x7b78000002ae by thread T11: #0 DownstreamState::healthCheckRequired(std::optional<long>) /__w/pdns/pdns/pdns/dnsdistdist/dnsdist-backend.cc:555:16 (dnsdist+0x18f003) #1 healthChecksThread() /__w/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2046:17 (dnsdist+0x811ea9) #2 void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x1dfe39) #3 std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0x1dfe39) #4 void std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0x1dfe39) #5 std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0x1dfe39) #6 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0x1dfe39) #7 <null> <null> (libstdc++.so.6+0xceecf) Previous write of size 1 at 0x7b78000002ae by thread T21 (mutexes: write M189): #0 std::enable_if<IsOptional<DownstreamState>::value, setupLuaBindings(LuaContext&, bool)::$_15>::type LuaContext::readIntoFunction<void, LuaContext::Binder<void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)&, std::shared_ptr<DownstreamState> const&>&, boost::optional<bool> >(lua_State*, LuaContext::tag<setupLuaBindings(LuaContext&, bool)::$_15>, void&&, int, LuaContext::tag<DownstreamState>, LuaContext::tag<boost::optional<bool> >) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp (dnsdist+0x4b6ab2) #1 std::enable_if<!(IsOptional<DownstreamState>::value), setupLuaBindings(LuaContext&, bool)::$_15>::type LuaContext::readIntoFunction<void, void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)&, std::shared_ptr<DownstreamState>, boost::optional<bool> >(lua_State*, LuaContext::tag<setupLuaBindings(LuaContext&, bool)::$_15>, void&&, int, LuaContext::tag<DownstreamState>, LuaContext::tag<boost::optional<bool> >) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1803:16 (dnsdist+0x4b6ab2) #2 std::enable_if<(std::integral_constant<bool, true>::value) && (!(std::is_void<setupLuaBindings(LuaContext&, bool)::$_15>::value)), LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<DownstreamState>, boost::optional<bool>), void>::callback2<void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)&>(lua_State*, setupLuaBindings(LuaContext&, bool)::$_15&&, int) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2443:9 (dnsdist+0x4b6ab2) #3 LuaContext::PushedObject LuaContext::Pusher<void (std::shared_ptr<DownstreamState>, boost::optional<bool>), void>::callback<void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)>(lua_State*, setupLuaBindings(LuaContext&, bool)::$_15*, int) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2405:20 (dnsdist+0x4b6ab2) #4 std::enable_if<boost::has_trivial_destructor<setupLuaBindings(LuaContext&, bool)::$_15>::value, LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<DownstreamState>, boost::optional<bool>), void>::push<void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)>(lua_State*, setupLuaBindings(LuaContext&, bool)::$_15)::'lambda'(lua_State*)::operator()(lua_State*) const /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2334:20 (dnsdist+0x4b6ab2) #5 std::enable_if<boost::has_trivial_destructor<setupLuaBindings(LuaContext&, bool)::$_15>::value, LuaContext::PushedObject>::type LuaContext::Pusher<void (std::shared_ptr<DownstreamState>, boost::optional<bool>), void>::push<void LuaContext::registerFunctionImpl<setupLuaBindings(LuaContext&, bool)::$_15, void, DownstreamState, boost::optional<bool> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, setupLuaBindings(LuaContext&, bool)::$_15, LuaContext::tag<DownstreamState>, LuaContext::tag<void (boost::optional<bool>)>)::'lambda'(std::shared_ptr<DownstreamState> const&, boost::optional<bool>)>(lua_State*, setupLuaBindings(LuaContext&, bool)::$_15)::'lambda'(lua_State*)::__invoke(lua_State*) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2330:31 (dnsdist+0x4b6ab2) #6 <null> <null> (libluajit-5.1.so.2+0xa5e6) #7 boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > LuaContext::call<boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > >(lua_State*, LuaContext::PushedObject) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1413:29 (dnsdist+0x1c2b4b) #8 boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > LuaContext::executeCode<boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > >(char const*) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:324:16 (dnsdist+0x1c2b4b) #9 boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > LuaContext::executeCode<boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:301:16 (dnsdist+0x1bf450) #10 controlClientThread(ConsoleConnection&&) /__w/pdns/pdns/pdns/dnsdistdist/dnsdist-console.cc:897:27 (dnsdist+0x1bf450) #11 boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > LuaContext::executeCode<boost::optional<boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<DownstreamState>, ClientState*, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, double, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, double> > > > > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:301:16 (dnsdist+0x1bf450) #12 controlClientThread(ConsoleConnection&&) /__w/pdns/pdns/pdns/dnsdistdist/dnsdist-console.cc:897:27 (dnsdist+0x1bf450) #13 void std::__invoke_impl<void, void (*)(ConsoleConnection&&), ConsoleConnection>(std::__invoke_other, void (*&&)(ConsoleConnection&&), ConsoleConnection&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x1c76f3) #14 std::__invoke_result<void (*)(ConsoleConnection&&), ConsoleConnection>::type std::__invoke<void (*)(ConsoleConnection&&), ConsoleConnection>(void (*&&)(ConsoleConnection&&), ConsoleConnection&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0x1c76f3) #15 void std::thread::_Invoker<std::tuple<void (*)(ConsoleConnection&&), ConsoleConnection> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0x1c76f3) #16 std::thread::_Invoker<std::tuple<void (*)(ConsoleConnection&&), ConsoleConnection> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0x1c76f3) #17 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(ConsoleConnection&&), ConsoleConnection> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0x1c76f3) #18 <null> <null> (libstdc++.so.6+0xceecf) As if synchronized via sleep: #0 healthChecksThread() /__w/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2034:5 (dnsdist+0xc77e8) #1 void std::__invoke_impl<void, void (*)()>(std::__invoke_other, void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x811b8e) #2 std::__invoke_result<void (*)()>::type std::__invoke<void (*)()>(void (*&&)()) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0x811b8e) #3 void std::thread::_Invoker<std::tuple<void (*)()> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0x811b8e) #4 std::thread::_Invoker<std::tuple<void (*)()> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0x811b8e) #5 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)()> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0x811b8e) #6 <null> <null> (dnsdist+0x1dfe39) #7 operator new(unsigned long, std::align_val_t) <null> (libstdc++.so.6+0xceecf) Location is heap block of size 2880 at 0x7b7800000000 allocated by main thread: #0 __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/ext/new_allocator.h:112:31 (dnsdist+0x13f29c) #1 std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/alloc_traits.h:460:20 (dnsdist+0x13f29c) #2 std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<DownstreamState, std::allocator<DownstreamState>, (__gnu_cxx::_Lock_policy)2> >&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/allocated_ptr.h:97:21 (dnsdist+0x13f29c) #3 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<DownstreamState, std::allocator<DownstreamState>, DownstreamState::Config, std::shared_ptr<TLSCtx>, bool>(DownstreamState*&, std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, DownstreamState::Config&&, std::shared_ptr<TLSCtx>&&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:680:19 (dnsdist+0x13f29c) #4 std::__shared_ptr<DownstreamState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<DownstreamState>, DownstreamState::Config, std::shared_ptr<TLSCtx>, bool>(std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, DownstreamState::Config&&, std::shared_ptr<TLSCtx>&&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1371:14 (dnsdist+0x13f29c) #5 std::shared_ptr<DownstreamState>::shared_ptr<std::allocator<DownstreamState>, DownstreamState::Config, std::shared_ptr<TLSCtx>, bool>(std::_Sp_alloc_shared_tag<std::allocator<DownstreamState> >, DownstreamState::Config&&, std::shared_ptr<TLSCtx>&&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:408:4 (dnsdist+0x1db3be) #6 std::shared_ptr<DownstreamState> std::allocate_shared<DownstreamState, std::allocator<DownstreamState>, DownstreamState::Config, std::shared_ptr<TLSCtx>, bool>(std::allocator<DownstreamState> const&, DownstreamState::Config&&, std::shared_ptr<TLSCtx>&&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:859:14 (dnsdist+0x1db3be) #7 std::shared_ptr<DownstreamState> std::make_shared<DownstreamState, DownstreamState::Config, std::shared_ptr<TLSCtx>, bool>(DownstreamState::Config&&, std::shared_ptr<TLSCtx>&&, bool&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr.h:875:14 (dnsdist+0x1db3be) #8 setupLuaConfig(LuaContext&, bool, bool)::$_3::operator()(boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>) const /__w/pdns/pdns/pdns/dnsdistdist/dnsdist-lua.cc:619:37 (dnsdist+0x1db3be) #9 tor<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::callback2<setupLuaConfig(LuaContext&, bool, bool)::$_3&>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_3&, int) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2436:31 (dnsdist+0x69065d) #10 LuaContext::PushedObject LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::callback<setupLuaConfig(LuaContext&, bool, bool)::$_3>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_3*, int) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2405:20 (dnsdist+0x69065d) #11 std::enable_if<boost::has_trivial_destructor<setupLuaConfig(LuaContext&, bool, bool)::$_3>::value, LuaContext::PushedObject>::type LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::push<setupLuaConfig(LuaContext&, bool, bool)::$_3>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_3)::'lambda'(lua_State*)::operator()(lua_State*) const /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2334:20 (dnsdist+0x69065d) #12 std::enable_if<boost::has_trivial_destructor<setupLuaConfig(LuaContext&, bool, bool)::$_3>::value, LuaContext::PushedObject>::type LuaContext::Pusher<std::shared_ptr<DownstreamState> (boost::variant<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, boost::variant<bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, std::function<std::tuple<DNSName, unsigned short, unsigned short> (DNSName const&, unsigned short, unsigned short, dnsheader*)> > > > > >, boost::optional<int>), void>::push<setupLuaConfig(LuaContext&, bool, bool)::$_3>(lua_State*, setupLuaConfig(LuaContext&, bool, bool)::$_3)::'lambda'(lua_State*)::__invoke(lua_State*) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:2330:31 (dnsdist+0x69065d) #13 <null> <null> (dnsdist+0x687942) #14 <null> <null> (libluajit-5.1.so.2+0xa5e6) #15 std::tuple<> LuaContext::call<std::tuple<> >(lua_State*, LuaContext::PushedObject) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:1413:29 (dnsdist+0x577e85) #16 LuaContext::executeCode(std::istream&) /__w/pdns/pdns/pdns/dnsdistdist/./ext/luawrapper/include/LuaContext.hpp:267:9 (dnsdist+0x685db6) #17 setupLua(LuaContext&, bool, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /__w/pdns/pdns/pdns/dnsdistdist/dnsdist-lua.cc:3025:10 (dnsdist+0x67b759) #18 main /__w/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2668:17 (dnsdist+0x809d2c) Mutex M189 (0x55801da4cdf0) created at: #0 pthread_mutex_lock <null> (dnsdist+0xe74f8) #1 __gthread_mutex_lock(pthread_mutex_t*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/gthr-default.h:749:12 (dnsdist+0x80c177) #2 std::mutex::lock() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_mutex.h:100:17 (dnsdist+0x80c177) #3 std::lock_guard<std::mutex>::lock_guard(std::mutex&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_mutex.h:159:19 (dnsdist+0x80c177) #4 LockGuardedHolder<LuaContext>::LockGuardedHolder(LuaContext&, std::mutex&) /__w/pdns/pdns/pdns/dnsdistdist/./lock.hh:209:60 (dnsdist+0x80c177) #5 LockGuarded<LuaContext>::lock() /__w/pdns/pdns/pdns/dnsdistdist/./lock.hh:289:12 (dnsdist+0x80c177) #6 main /__w/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2668:34 (dnsdist+0x809d0c) Thread T11 'dnsdist/healthC' (tid=5313, running) created by main thread at: #0 pthread_create <null> (dnsdist+0xca21d) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xcf144) #2 main /__w/pdns/pdns/pdns/dnsdistdist/dnsdist.cc:2938:12 (dnsdist+0x80b06e) Thread T21 'dnsdist/conscli' (tid=5325, finished) created by thread T5 at: #0 pthread_create <null> (dnsdist+0xca21d) #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xcf144) #2 void std::__invoke_impl<void, void (*)(int, ComboAddress), int, ComboAddress>(std::__invoke_other, void (*&&)(int, ComboAddress), int&&, ComboAddress&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14 (dnsdist+0x6c0435) #3 std::__invoke_result<void (*)(int, ComboAddress), int, ComboAddress>::type std::__invoke<void (*)(int, ComboAddress), int, ComboAddress>(void (*&&)(int, ComboAddress), int&&, ComboAddress&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14 (dnsdist+0x6c0435) #4 void std::thread::_Invoker<std::tuple<void (*)(int, ComboAddress), int, ComboAddress> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13 (dnsdist+0x6c0435) #5 std::thread::_Invoker<std::tuple<void (*)(int, ComboAddress), int, ComboAddress> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11 (dnsdist+0x6c0435) #6 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(int, ComboAddress), int, ComboAddress> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13 (dnsdist+0x6c0435) #7 <null> <null> (libstdc++.so.6+0xceecf) ```
Habbie
pushed a commit
that referenced
this pull request
Sep 6, 2023
We used to get a index from OpenSSL when the first incoming or outgoing TLS connection was created. That index is later used to store application-related data along the TLS connection, to be able to access it in callbacks called from inside the OpenSSL library. Unfortunately the atomic flag construction used was racy: if a second connection is created while the first one is still getting the index, it could be reading the initial value (-1) instead of the actual index, which might prevent the callback from working properly because they cannot retrieve the necessary data. The good news is that this should not have a serious impact: a TLS session might not be properly resumed while it should have been, leading to a full TLS session negotiation. This commit fixes the race by using a full mutex and only releasing it once the value has been computed. In order to avoid a performance penalty, the index is now computed when a TLS connection _context_ is created, instead of a TLS connection. TLS contexts should be reused for a large number of connections, and mostly created during startup or in the first few seconds of the application. The race was reported by Thread Sanitizer during the `test_TLS.py::TestTLSFrontendLimits::testTCPConnsPerTLSFrontend` regression test as: ``` WARNING: ThreadSanitizer: data race (pid=120466) Read of size 4 at 0x55a12bf3d758 by thread T4: #0 OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:106 (dnsdist+0x97ece8) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #1 std::__detail::_MakeUniq<OpenSSLTLSConnection>::__single_object std::make_unique<OpenSSLTLSConnection, int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&>(int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x97eff6) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #2 OpenSSLTLSIOCtx::getConnection(int, timeval const&, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:797 (dnsdist+0x97eff6) #3 TCPIOHandler::TCPIOHandler(int, timeval const&, std::shared_ptr<TLSCtx>, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.hh:246 (dnsdist+0x88c24f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 IncomingTCPConnectionState::IncomingTCPConnectionState(ConnectionInfo&&, TCPClientThreadData&, timeval const&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp-upstream.hh:29 (dnsdist+0x88c24f) #5 void std::_Construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/stl_construct.h:119 (dnsdist+0x878b1e) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 void std::allocator_traits<std::allocator<void> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/alloc_traits.h:660 (dnsdist+0x878b1e) #7 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:604 (dnsdist+0x878b1e) #8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:971 (dnsdist+0x878b1e) #9 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:1712 (dnsdist+0x878b1e) #10 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:464 (dnsdist+0x878b1e) #11 std::shared_ptr<std::enable_if<!std::is_array<IncomingTCPConnectionState>::value, IncomingTCPConnectionState>::type> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:1010 (dnsdist+0x878b1e) #12 handleIncomingTCPQuery /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1118 (dnsdist+0x878b1e) #13 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x32d951) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #14 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:111 (dnsdist+0x32d951) #15 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/include/c++/13.2.1/bits/std_function.h:290 (dnsdist+0x32d951) #16 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/include/c++/13.2.1/bits/std_function.h:591 (dnsdist+0x98fc0f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #17 EpollFDMultiplexer::run(timeval*, int) /work/pdns/pdns/dnsdistdist/epollmplexer.cc:190 (dnsdist+0x98fc0f) #18 tcpClientThread /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1251 (dnsdist+0x86cb7f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #19 void std::__invoke_impl<void, void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x87aab1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #20 std::__invoke_result<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:96 (dnsdist+0x87aab1) #21 void std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/include/c++/13.2.1/bits/std_thread.h:292 (dnsdist+0x87aab1) #22 std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/include/c++/13.2.1/bits/std_thread.h:299 (dnsdist+0x87aab1) #23 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/include/c++/13.2.1/bits/std_thread.h:244 (dnsdist+0x87aab1) #24 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104 (libstdc++.so.6+0xe1942) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) Previous write of size 4 at 0x55a12bf3d758 by thread T3: #0 OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:88 (dnsdist+0x97ed98) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #1 std::__detail::_MakeUniq<OpenSSLTLSConnection>::__single_object std::make_unique<OpenSSLTLSConnection, int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&>(int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x97eff6) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #2 OpenSSLTLSIOCtx::getConnection(int, timeval const&, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:797 (dnsdist+0x97eff6) #3 TCPIOHandler::TCPIOHandler(int, timeval const&, std::shared_ptr<TLSCtx>, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.hh:246 (dnsdist+0x88c24f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 IncomingTCPConnectionState::IncomingTCPConnectionState(ConnectionInfo&&, TCPClientThreadData&, timeval const&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp-upstream.hh:29 (dnsdist+0x88c24f) #5 void std::_Construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/stl_construct.h:119 (dnsdist+0x878b1e) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 void std::allocator_traits<std::allocator<void> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/alloc_traits.h:660 (dnsdist+0x878b1e) #7 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:604 (dnsdist+0x878b1e) #8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:971 (dnsdist+0x878b1e) #9 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:1712 (dnsdist+0x878b1e) #10 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:464 (dnsdist+0x878b1e) #11 std::shared_ptr<std::enable_if<!std::is_array<IncomingTCPConnectionState>::value, IncomingTCPConnectionState>::type> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:1010 (dnsdist+0x878b1e) #12 handleIncomingTCPQuery /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1118 (dnsdist+0x878b1e) #13 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x32d951) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #14 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:111 (dnsdist+0x32d951) #15 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/include/c++/13.2.1/bits/std_function.h:290 (dnsdist+0x32d951) #16 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/include/c++/13.2.1/bits/std_function.h:591 (dnsdist+0x98fc0f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #17 EpollFDMultiplexer::run(timeval*, int) /work/pdns/pdns/dnsdistdist/epollmplexer.cc:190 (dnsdist+0x98fc0f) #18 tcpClientThread /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1251 (dnsdist+0x86cb7f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #19 void std::__invoke_impl<void, void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x87aab1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #20 std::__invoke_result<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:96 (dnsdist+0x87aab1) #21 void std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/include/c++/13.2.1/bits/std_thread.h:292 (dnsdist+0x87aab1) #22 std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/include/c++/13.2.1/bits/std_thread.h:299 (dnsdist+0x87aab1) #23 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/include/c++/13.2.1/bits/std_thread.h:244 (dnsdist+0x87aab1) #24 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104 (libstdc++.so.6+0xe1942) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) Location is global 'OpenSSLTLSConnection::s_tlsConnIndex' of size 4 at 0x55a12bf3d758 (dnsdist+0xc49758) Thread T4 'dnsdist/tcpClie' (tid=120471, running) created by main thread at: #0 pthread_create /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1036 (libtsan.so.2+0x44219) (BuildId: 7e8fcb9ed0a63b98f2293e37c92ac955413efd9e) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xe1a29) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:172 (libstdc++.so.6+0xe1a29) #3 TCPClientCollection::addTCPClientThread(std::vector<ClientState*, std::allocator<ClientState*> >&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:149 (dnsdist+0x8685a1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126 (dnsdist+0x868912) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #5 std::__detail::_MakeUniq<TCPClientCollection>::__single_object std::make_unique<TCPClientCollection, unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> > >(unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x20adef) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 main /work/pdns/pdns/dnsdistdist/dnsdist.cc:2865 (dnsdist+0x20adef) Thread T3 'dnsdist/tcpClie' (tid=120470, running) created by main thread at: #0 pthread_create /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1036 (libtsan.so.2+0x44219) (BuildId: 7e8fcb9ed0a63b98f2293e37c92ac955413efd9e) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xe1a29) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:172 (libstdc++.so.6+0xe1a29) #3 TCPClientCollection::addTCPClientThread(std::vector<ClientState*, std::allocator<ClientState*> >&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:149 (dnsdist+0x8685a1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126 (dnsdist+0x868912) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #5 std::__detail::_MakeUniq<TCPClientCollection>::__single_object std::make_unique<TCPClientCollection, unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> > >(unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x20adef) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 main /work/pdns/pdns/dnsdistdist/dnsdist.cc:2865 (dnsdist+0x20adef) SUMMARY: ThreadSanitizer: data race /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:106 in OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) ```
Habbie
pushed a commit
that referenced
this pull request
Oct 11, 2023
We used to get a index from OpenSSL when the first incoming or outgoing TLS connection was created. That index is later used to store application-related data along the TLS connection, to be able to access it in callbacks called from inside the OpenSSL library. Unfortunately the atomic flag construction used was racy: if a second connection is created while the first one is still getting the index, it could be reading the initial value (-1) instead of the actual index, which might prevent the callback from working properly because they cannot retrieve the necessary data. The good news is that this should not have a serious impact: a TLS session might not be properly resumed while it should have been, leading to a full TLS session negotiation. This commit fixes the race by using a full mutex and only releasing it once the value has been computed. In order to avoid a performance penalty, the index is now computed when a TLS connection _context_ is created, instead of a TLS connection. TLS contexts should be reused for a large number of connections, and mostly created during startup or in the first few seconds of the application. The race was reported by Thread Sanitizer during the `test_TLS.py::TestTLSFrontendLimits::testTCPConnsPerTLSFrontend` regression test as: ``` WARNING: ThreadSanitizer: data race (pid=120466) Read of size 4 at 0x55a12bf3d758 by thread T4: #0 OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:106 (dnsdist+0x97ece8) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #1 std::__detail::_MakeUniq<OpenSSLTLSConnection>::__single_object std::make_unique<OpenSSLTLSConnection, int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&>(int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x97eff6) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #2 OpenSSLTLSIOCtx::getConnection(int, timeval const&, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:797 (dnsdist+0x97eff6) #3 TCPIOHandler::TCPIOHandler(int, timeval const&, std::shared_ptr<TLSCtx>, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.hh:246 (dnsdist+0x88c24f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 IncomingTCPConnectionState::IncomingTCPConnectionState(ConnectionInfo&&, TCPClientThreadData&, timeval const&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp-upstream.hh:29 (dnsdist+0x88c24f) #5 void std::_Construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/stl_construct.h:119 (dnsdist+0x878b1e) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 void std::allocator_traits<std::allocator<void> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/alloc_traits.h:660 (dnsdist+0x878b1e) #7 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:604 (dnsdist+0x878b1e) #8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:971 (dnsdist+0x878b1e) #9 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:1712 (dnsdist+0x878b1e) #10 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:464 (dnsdist+0x878b1e) #11 std::shared_ptr<std::enable_if<!std::is_array<IncomingTCPConnectionState>::value, IncomingTCPConnectionState>::type> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:1010 (dnsdist+0x878b1e) #12 handleIncomingTCPQuery /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1118 (dnsdist+0x878b1e) #13 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x32d951) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #14 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:111 (dnsdist+0x32d951) #15 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/include/c++/13.2.1/bits/std_function.h:290 (dnsdist+0x32d951) #16 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/include/c++/13.2.1/bits/std_function.h:591 (dnsdist+0x98fc0f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #17 EpollFDMultiplexer::run(timeval*, int) /work/pdns/pdns/dnsdistdist/epollmplexer.cc:190 (dnsdist+0x98fc0f) #18 tcpClientThread /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1251 (dnsdist+0x86cb7f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #19 void std::__invoke_impl<void, void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x87aab1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #20 std::__invoke_result<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:96 (dnsdist+0x87aab1) #21 void std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/include/c++/13.2.1/bits/std_thread.h:292 (dnsdist+0x87aab1) #22 std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/include/c++/13.2.1/bits/std_thread.h:299 (dnsdist+0x87aab1) #23 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/include/c++/13.2.1/bits/std_thread.h:244 (dnsdist+0x87aab1) #24 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104 (libstdc++.so.6+0xe1942) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) Previous write of size 4 at 0x55a12bf3d758 by thread T3: #0 OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:88 (dnsdist+0x97ed98) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #1 std::__detail::_MakeUniq<OpenSSLTLSConnection>::__single_object std::make_unique<OpenSSLTLSConnection, int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&>(int&, timeval const&, std::shared_ptr<OpenSSLFrontendContext>&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x97eff6) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #2 OpenSSLTLSIOCtx::getConnection(int, timeval const&, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:797 (dnsdist+0x97eff6) #3 TCPIOHandler::TCPIOHandler(int, timeval const&, std::shared_ptr<TLSCtx>, long) /work/pdns/pdns/dnsdistdist/tcpiohandler.hh:246 (dnsdist+0x88c24f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 IncomingTCPConnectionState::IncomingTCPConnectionState(ConnectionInfo&&, TCPClientThreadData&, timeval const&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp-upstream.hh:29 (dnsdist+0x88c24f) #5 void std::_Construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/stl_construct.h:119 (dnsdist+0x878b1e) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 void std::allocator_traits<std::allocator<void> >::construct<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>&, IncomingTCPConnectionState*, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/alloc_traits.h:660 (dnsdist+0x878b1e) #7 std::_Sp_counted_ptr_inplace<IncomingTCPConnectionState, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<ConnectionInfo, TCPClientThreadData&, timeval&>(std::allocator<void>, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:604 (dnsdist+0x878b1e) #8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<IncomingTCPConnectionState, std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(IncomingTCPConnectionState*&, std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:971 (dnsdist+0x878b1e) #9 std::__shared_ptr<IncomingTCPConnectionState, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr_base.h:1712 (dnsdist+0x878b1e) #10 std::shared_ptr<IncomingTCPConnectionState>::shared_ptr<std::allocator<void>, ConnectionInfo, TCPClientThreadData&, timeval&>(std::_Sp_alloc_shared_tag<std::allocator<void> >, ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:464 (dnsdist+0x878b1e) #11 std::shared_ptr<std::enable_if<!std::is_array<IncomingTCPConnectionState>::value, IncomingTCPConnectionState>::type> std::make_shared<IncomingTCPConnectionState, ConnectionInfo, TCPClientThreadData&, timeval&>(ConnectionInfo&&, TCPClientThreadData&, timeval&) /usr/include/c++/13.2.1/bits/shared_ptr.h:1010 (dnsdist+0x878b1e) #12 handleIncomingTCPQuery /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1118 (dnsdist+0x878b1e) #13 void std::__invoke_impl<void, void (*&)(int, boost::any&), int, boost::any&>(std::__invoke_other, void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x32d951) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #14 std::enable_if<is_invocable_r_v<void, void (*&)(int, boost::any&), int, boost::any&>, void>::type std::__invoke_r<void, void (*&)(int, boost::any&), int, boost::any&>(void (*&)(int, boost::any&), int&&, boost::any&) /usr/include/c++/13.2.1/bits/invoke.h:111 (dnsdist+0x32d951) #15 std::_Function_handler<void (int, boost::any&), void (*)(int, boost::any&)>::_M_invoke(std::_Any_data const&, int&&, boost::any&) /usr/include/c++/13.2.1/bits/std_function.h:290 (dnsdist+0x32d951) #16 std::function<void (int, boost::any&)>::operator()(int, boost::any&) const /usr/include/c++/13.2.1/bits/std_function.h:591 (dnsdist+0x98fc0f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #17 EpollFDMultiplexer::run(timeval*, int) /work/pdns/pdns/dnsdistdist/epollmplexer.cc:190 (dnsdist+0x98fc0f) #18 tcpClientThread /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:1251 (dnsdist+0x86cb7f) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #19 void std::__invoke_impl<void, void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(std::__invoke_other, void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:61 (dnsdist+0x87aab1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #20 std::__invoke_result<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >::type std::__invoke<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > >(void (*&&)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/invoke.h:96 (dnsdist+0x87aab1) #21 void std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::_M_invoke<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>(std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul>) /usr/include/c++/13.2.1/bits/std_thread.h:292 (dnsdist+0x87aab1) #22 std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > >::operator()() /usr/include/c++/13.2.1/bits/std_thread.h:299 (dnsdist+0x87aab1) #23 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >&&, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >&&, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >&&, std::vector<ClientState*, std::allocator<ClientState*> >), pdns::channel::Receiver<ConnectionInfo, std::default_delete<ConnectionInfo> >, pdns::channel::Receiver<CrossProtocolQuery, std::default_delete<CrossProtocolQuery> >, pdns::channel::Receiver<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, pdns::channel::Sender<TCPCrossProtocolResponse, std::default_delete<TCPCrossProtocolResponse> >, std::vector<ClientState*, std::allocator<ClientState*> > > > >::_M_run() /usr/include/c++/13.2.1/bits/std_thread.h:244 (dnsdist+0x87aab1) #24 execute_native_thread_routine /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104 (libstdc++.so.6+0xe1942) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) Location is global 'OpenSSLTLSConnection::s_tlsConnIndex' of size 4 at 0x55a12bf3d758 (dnsdist+0xc49758) Thread T4 'dnsdist/tcpClie' (tid=120471, running) created by main thread at: #0 pthread_create /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1036 (libtsan.so.2+0x44219) (BuildId: 7e8fcb9ed0a63b98f2293e37c92ac955413efd9e) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xe1a29) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:172 (libstdc++.so.6+0xe1a29) #3 TCPClientCollection::addTCPClientThread(std::vector<ClientState*, std::allocator<ClientState*> >&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:149 (dnsdist+0x8685a1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126 (dnsdist+0x868912) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #5 std::__detail::_MakeUniq<TCPClientCollection>::__single_object std::make_unique<TCPClientCollection, unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> > >(unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x20adef) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 main /work/pdns/pdns/dnsdistdist/dnsdist.cc:2865 (dnsdist+0x20adef) Thread T3 'dnsdist/tcpClie' (tid=120470, running) created by main thread at: #0 pthread_create /usr/src/debug/gcc/gcc/libsanitizer/tsan/tsan_interceptors_posix.cpp:1036 (libtsan.so.2+0x44219) (BuildId: 7e8fcb9ed0a63b98f2293e37c92ac955413efd9e) #1 __gthread_create /usr/src/debug/gcc/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu/bits/gthr-default.h:663 (libstdc++.so.6+0xe1a29) (BuildId: 207eb738c5976dd9aac1ae0640fc4de5946b547e) #2 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:172 (libstdc++.so.6+0xe1a29) #3 TCPClientCollection::addTCPClientThread(std::vector<ClientState*, std::allocator<ClientState*> >&) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:149 (dnsdist+0x8685a1) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #4 TCPClientCollection::TCPClientCollection(unsigned long, std::vector<ClientState*, std::allocator<ClientState*> >) /work/pdns/pdns/dnsdistdist/dnsdist-tcp.cc:126 (dnsdist+0x868912) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #5 std::__detail::_MakeUniq<TCPClientCollection>::__single_object std::make_unique<TCPClientCollection, unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> > >(unsigned long&, std::vector<ClientState*, std::allocator<ClientState*> >&&) /usr/include/c++/13.2.1/bits/unique_ptr.h:1070 (dnsdist+0x20adef) (BuildId: ad82581368352777fda41d4b4145ba8ec738044c) #6 main /work/pdns/pdns/dnsdistdist/dnsdist.cc:2865 (dnsdist+0x20adef) SUMMARY: ThreadSanitizer: data race /work/pdns/pdns/dnsdistdist/tcpiohandler.cc:106 in OpenSSLTLSConnection::OpenSSLTLSConnection(int, timeval const&, std::shared_ptr<OpenSSLFrontendContext>) ``` (cherry picked from commit b56f05b)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.