wallet: Data race in GetOrCreateLegacyScriptPubKeyMan vs IsMine #27354

issue maflcko openend this issue on March 28, 2023
  1. maflcko commented at 12:52 pm on March 28, 2023: member

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    tsan error

    Expected behaviour

    no tsan error

    Steps to reproduce

    I presume the error is intermittent, but the basic idea is that the validation interface thread (scheduler) may connect blocks and sync wallet transactions, thus call IsMine and access m_spk_managers. At the same time, the main thread may call GetOrCreateLegacyScriptPubKeyMan, also accessing m_spk_managers, thus running into a race.

    This happens in tests, see below.

    However, I think this may also happen in production, so a proper fix would be to protect m_spk_managers with a mutex? If not, it might be sufficient to add a SyncWithValidationInterfaceQueue() somewhere in the test.

    Relevant log output

    https://cirrus-ci.com/task/6202645656895488?logs=check#L3078

      0wallet/test/wallet_tests.cpp(430): Leaving test case "LoadReceiveRequests"; testing time: 72958us
      1wallet/test/wallet_tests.cpp(491): Entering test case "WatchOnlyPubKeys"
      22023-03-26T06:23:28.508912Z [test] [test/util/setup_common.cpp:90] [Seed] Seed: Setting random seed for current tests to RANDOM_CTX_SEED=76c898d9e4bcec2024b506a637197960a4dd511e4d7efc74bda42b593ffa946e
      32023-03-26T06:23:28.509010Z [test] [init/common.cpp:149] [LogPackageVersion] Bitcoin Core version v24.99.0-e352f5ab6b60 (release build)
      42023-03-26T06:23:28.509290Z [test] [kernel/context.cpp:21] [Context] Using the 'x86_shani(1way,2way)' SHA256 implementation
      52023-03-26T06:23:28.509321Z [test] [random.cpp:99] [ReportHardwareRand] Using RdSeed as an additional entropy source
      62023-03-26T06:23:28.509340Z [test] [random.cpp:102] [ReportHardwareRand] Using RdRand as an additional entropy source
      72023-03-26T06:23:28.531198Z [test] [script/sigcache.cpp:103] [InitSignatureCache] Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements
      82023-03-26T06:23:28.552320Z [test] [validation.cpp:1746] [InitScriptExecutionCache] Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements
      92023-03-26T06:23:28.552562Z [scheduler] [util/thread.cpp:20] [TraceThread] scheduler thread start
     102023-03-26T06:23:28.614893Z [test] [policy/fees.cpp:551] [CBlockPolicyEstimator] Failed to read fee estimates from /tmp/test_common_Bitcoin Core/8c8d5cefbd9d876fe95b7ed8e54bcbb495acc1633fa2a0c21901247b82e65657/fee_estimates.dat. Continue anyway.
     112023-03-26T06:23:28.615452Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
     122023-03-26T06:23:28.615506Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/8c8d5cefbd9d876fe95b7ed8e54bcbb495acc1633fa2a0c21901247b82e65657/blocks/index: 0000000000000000
     132023-03-26T06:23:28.616680Z [test] [node/chainstate.cpp:164] [LoadChainstate] Assuming ancestors of block 00000000000000000009c97098b5295f7e5f183ac811fb5d1534040adb93cabd have valid signatures.
     142023-03-26T06:23:28.625895Z [test] [node/chainstate.cpp:168] [LoadChainstate] Setting nMinimumChainWork=00000000000000000000000000000000000000003404ba0801921119f903495e
     152023-03-26T06:23:28.626343Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
     162023-03-26T06:23:28.626395Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/8c8d5cefbd9d876fe95b7ed8e54bcbb495acc1633fa2a0c21901247b82e65657/blocks/index: 0000000000000000
     172023-03-26T06:23:28.626449Z [test] [node/blockstorage.cpp:329] [LoadBlockIndexDB] LoadBlockIndexDB: last block file = 0
     182023-03-26T06:23:28.626493Z [test] [node/blockstorage.cpp:333] [LoadBlockIndexDB] LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0...0, time=1970-01-01...1970-01-01)
     192023-03-26T06:23:28.626522Z [test] [node/blockstorage.cpp:344] [LoadBlockIndexDB] Checking all blk files are present...
     202023-03-26T06:23:28.626559Z [test] [validation.cpp:4493] [LoadBlockIndex] Initializing databases...
     212023-03-26T06:23:28.626732Z [test] [flatfile.cpp:69] [Allocate] [validation] Pre-allocating up to position 0x1000000 in blk00000.dat
     222023-03-26T06:23:28.626883Z [test] [node/chainstate.cpp:106] [CompleteChainstateInitialization] Initializing chainstate Chainstate [ibd] @ height -1 (null)
     232023-03-26T06:23:28.627148Z [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
     242023-03-26T06:23:28.627227Z [test] [dbwrapper.cpp:180] [CDBWrapper] Wrote new obfuscate key for /tmp/test_common_Bitcoin Core/8c8d5cefbd9d876fe95b7ed8e54bcbb495acc1633fa2a0c21901247b82e65657/chainstate: d296978c75cdee55
     252023-03-26T06:23:28.627255Z [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/8c8d5cefbd9d876fe95b7ed8e54bcbb495acc1633fa2a0c21901247b82e65657/chainstate: d296978c75cdee55
     262023-03-26T06:23:28.627324Z [test] [validation.cpp:5538] [MaybeRebalanceCaches] [snapshot] allocating all cache to the IBD chainstate
     272023-03-26T06:23:28.627366Z [test] [validation.cpp:4920] [ResizeCoinsCaches] [Chainstate [ibd] @ height -1 (null)] resized coinsdb cache to 8.0 MiB
     282023-03-26T06:23:28.627394Z [test] [validation.cpp:4922]==================
     29WARNING: ThreadSanitizer: data race (pid=31396)
     30  Read of size 8 at 0x7b1400034d90 by thread T19 (mutexes: write M0):
     31    [#0](/bitcoin-bitcoin/0/) std::__uniq_ptr_impl<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>::_M_ptr() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:191:51 (test_bitcoin+0xd79cb8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     32    [#1](/bitcoin-bitcoin/1/) std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>::get() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:462:21 (test_bitcoin+0xd79cb8)
     33    [#2](/bitcoin-bitcoin/2/) std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>::operator->() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:455:9 (test_bitcoin+0xd79cb8)
     34    [#3](/bitcoin-bitcoin/3/) wallet::CWallet::IsMine(CScript const&) const src/wallet/wallet.cpp:1515:35 (test_bitcoin+0xd79cb8)
     35    [#4](/bitcoin-bitcoin/4/) wallet::CWallet::IsMine(CTxOut const&) const src/wallet/wallet.cpp:1501:12 (test_bitcoin+0xd79cb8)
     36    [#5](/bitcoin-bitcoin/5/) wallet::CWallet::IsMine(CTransaction const&) const src/wallet/wallet.cpp:1524:13 (test_bitcoin+0xd79cb8)
     37    [#6](/bitcoin-bitcoin/6/) wallet::CWallet::AddToWalletIfInvolvingMe(std::shared_ptr<CTransaction const> const&, std::variant<wallet::TxStateConfirmed, wallet::TxStateInMempool, wallet::TxStateInactive> const&, bool, bool) src/wallet/wallet.cpp:1207:25 (test_bitcoin+0xd79cb8)
     38    [#7](/bitcoin-bitcoin/7/) wallet::CWallet::SyncTransaction(std::shared_ptr<CTransaction const> const&, std::variant<wallet::TxStateConfirmed, wallet::TxStateInMempool, wallet::TxStateInactive> const&, bool, bool) src/wallet/wallet.cpp:1380:10 (test_bitcoin+0xd7cffa) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     39    [#8](/bitcoin-bitcoin/8/) wallet::CWallet::blockConnected(interfaces::BlockInfo const&) src/wallet/wallet.cpp:1444:9 (test_bitcoin+0xd7cffa)
     40    [#9](/bitcoin-bitcoin/9/) non-virtual thunk to wallet::CWallet::blockConnected(interfaces::BlockInfo const&) src/wallet/wallet.cpp (test_bitcoin+0xd7d243) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     41    [#10](/bitcoin-bitcoin/10/) node::(anonymous namespace)::NotificationsProxy::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*) src/node/interfaces.cpp:431:26 (test_bitcoin+0x11183f8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     42    [#11](/bitcoin-bitcoin/11/) CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::'lambda'(CValidationInterface&)::operator()(CValidationInterface&) const src/validationinterface.cpp:228:79 (test_bitcoin+0x13ef9a2) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     43    [#12](/bitcoin-bitcoin/12/) void MainSignalsImpl::Iterate<CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::'lambda'(CValidationInterface&)>(CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::'lambda'(CValidationInterface&)&&) src/validationinterface.cpp:88:17 (test_bitcoin+0x13ef9a2)
     44    [#13](/bitcoin-bitcoin/13/) CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const src/validationinterface.cpp:228:22 (test_bitcoin+0x13ef9a2)
     45    [#14](/bitcoin-bitcoin/14/) CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0::operator()() const src/validationinterface.cpp:230:5 (test_bitcoin+0x13ef9a2)
     46    [#15](/bitcoin-bitcoin/15/) void std::__invoke_impl<void, CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&>(std::__invoke_other, CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61:14 (test_bitcoin+0x13ef9a2)
     47    [#16](/bitcoin-bitcoin/16/) std::enable_if<is_invocable_r_v<void, CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&>, void>::type std::__invoke_r<void, CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&>(CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:111:2 (test_bitcoin+0x13ef9a2)
     48    [#17](/bitcoin-bitcoin/17/) std::_Function_handler<void (), CMainSignals::BlockConnected(std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:290:9 (test_bitcoin+0x13ef9a2)
     49    [#18](/bitcoin-bitcoin/18/) std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:591:9 (test_bitcoin+0x14b4f0c) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     50    [#19](/bitcoin-bitcoin/19/) SingleThreadedSchedulerClient::ProcessQueue() src/scheduler.cpp:175:5 (test_bitcoin+0x14b4f0c)
     51    [#20](/bitcoin-bitcoin/20/) SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0::operator()() const src/scheduler.cpp:144:41 (test_bitcoin+0x14b5ee3) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     52    [#21](/bitcoin-bitcoin/21/) void std::__invoke_impl<void, SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0&>(std::__invoke_other, SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61:14 (test_bitcoin+0x14b5ee3)
     53    [#22](/bitcoin-bitcoin/22/) std::enable_if<is_invocable_r_v<void, SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0&>, void>::type std::__invoke_r<void, SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0&>(SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:111:2 (test_bitcoin+0x14b5ee3)
     54    [#23](/bitcoin-bitcoin/23/) std::_Function_handler<void (), SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_0>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:290:9 (test_bitcoin+0x14b5ee3)
     55    [#24](/bitcoin-bitcoin/24/) std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:591:9 (test_bitcoin+0x14b3ecd) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     56    [#25](/bitcoin-bitcoin/25/) CScheduler::serviceQueue() src/scheduler.cpp:62:17 (test_bitcoin+0x14b3ecd)
     57    [#26](/bitcoin-bitcoin/26/) ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0::operator()() const src/test/util/setup_common.cpp:173:110 (test_bitcoin+0xc1d226) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     58    [#27](/bitcoin-bitcoin/27/) void std::__invoke_impl<void, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&>(std::__invoke_other, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61:14 (test_bitcoin+0xc1d226)
     59    [#28](/bitcoin-bitcoin/28/) std::enable_if<is_invocable_r_v<void, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&>, void>::type std::__invoke_r<void, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&>(ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:111:2 (test_bitcoin+0xc1d226)
     60    [#29](/bitcoin-bitcoin/29/) std::_Function_handler<void (), ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:290:9 (test_bitcoin+0xc1d226)
     61    [#30](/bitcoin-bitcoin/30/) std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:591:9 (test_bitcoin+0x157a6d9) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     62    [#31](/bitcoin-bitcoin/31/) util::TraceThread(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>) src/util/thread.cpp:21:9 (test_bitcoin+0x157a6d9)
     63    [#32](/bitcoin-bitcoin/32/) void std::__invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>(std::__invoke_other, void (*&&)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*&&, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61:14 (test_bitcoin+0xc1d132) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     64    [#33](/bitcoin-bitcoin/33/) std::__invoke_result<void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>::type std::__invoke<void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>(void (*&&)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*&&, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:96:14 (test_bitcoin+0xc1d132)
     65    [#34](/bitcoin-bitcoin/34/) void std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>>::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:252:13 (test_bitcoin+0xc1d132)
     66    [#35](/bitcoin-bitcoin/35/) std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>>::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:259:11 (test_bitcoin+0xc1d132)
     67    [#36](/bitcoin-bitcoin/36/) std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char>>, std::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&)::$_0>>>::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:210:13 (test_bitcoin+0xc1d132)
     68    [#37](/bitcoin-bitcoin/37/) <null> <null> (libstdc++.so.6+0xdc472) (BuildId: d8f370a6195f115a4e221070f20de2c68d281b66)
     69  Previous write of size 8 at 0x7b1400034d90 by main thread:
     70    [#0](/bitcoin-bitcoin/0/) operator new(unsigned long) <null> (test_bitcoin+0x1c36a7) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     71    [#1](/bitcoin-bitcoin/1/) std::__new_allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27 (test_bitcoin+0xdbdd38) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     72    [#2](/bitcoin-bitcoin/2/) std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20 (test_bitcoin+0xdbdd38)
     73    [#3](/bitcoin-bitcoin/3/) std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_get_node() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:561:16 (test_bitcoin+0xdbdd38)
     74    [#4](/bitcoin-bitcoin/4/) std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>* std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_create_node<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:611:23 (test_bitcoin+0xdbdd38)
     75    [#5](/bitcoin-bitcoin/5/) std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_Auto_node::_Auto_node<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>&, std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:1636:18 (test_bitcoin+0xdbdd38)
     76    [#6](/bitcoin-bitcoin/6/) std::_Rb_tree_iterator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>> std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:2461:13 (test_bitcoin+0xdbdd38)
     77    [#7](/bitcoin-bitcoin/7/) std::map<uint256, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::operator[](uint256&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_map.h:530:15 (test_bitcoin+0xd8d236) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     78    [#8](/bitcoin-bitcoin/8/) wallet::CWallet::SetupLegacyScriptPubKeyMan() src/wallet/wallet.cpp:3552:5 (test_bitcoin+0xd8d236)
     79    [#9](/bitcoin-bitcoin/9/) wallet::CWallet::GetOrCreateLegacyScriptPubKeyMan() src/wallet/wallet.cpp:3537:5 (test_bitcoin+0xd8fcdd) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     80    [#10](/bitcoin-bitcoin/10/) wallet::wallet_tests::WatchOnlyPubKeys::test_method() src/wallet/test/wallet_tests.cpp:495:47 (test_bitcoin+0xb6854b) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     81    [#11](/bitcoin-bitcoin/11/) wallet::wallet_tests::WatchOnlyPubKeys_invoker() src/wallet/test/wallet_tests.cpp:491:1 (test_bitcoin+0xb67fe2) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     82    [#12](/bitcoin-bitcoin/12/) boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (test_bitcoin+0x2edd5d) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     83    [#13](/bitcoin-bitcoin/13/) boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x2629e8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     84    [#14](/bitcoin-bitcoin/14/) boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (test_bitcoin+0x2629e8)
     85    [#15](/bitcoin-bitcoin/15/) boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (test_bitcoin+0x2629e8)
     86    [#16](/bitcoin-bitcoin/16/) boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x1e3a63) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     87    [#17](/bitcoin-bitcoin/17/) int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (test_bitcoin+0x1e3a63)
     88    [#18](/bitcoin-bitcoin/18/) boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (test_bitcoin+0x1e3a63)
     89    [#19](/bitcoin-bitcoin/19/) boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (test_bitcoin+0x1e3e1a) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     90    [#20](/bitcoin-bitcoin/20/) boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (test_bitcoin+0x1df504) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     91    [#21](/bitcoin-bitcoin/21/) boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (test_bitcoin+0x1df504)
     92    [#22](/bitcoin-bitcoin/22/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (test_bitcoin+0x217c0e) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     93    [#23](/bitcoin-bitcoin/23/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     94    [#24](/bitcoin-bitcoin/24/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     95    [#25](/bitcoin-bitcoin/25/) boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1722:29 (test_bitcoin+0x1de218) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     96    [#26](/bitcoin-bitcoin/26/) boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (test_bitcoin+0x1fbd28) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     97    [#27](/bitcoin-bitcoin/27/) main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (test_bitcoin+0x1fc2c3) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
     98  Location is heap block of size 72 at 0x7b1400034d50 allocated by main thread:
     99    [#0](/bitcoin-bitcoin/0/) operator new(unsigned long) <null> (test_bitcoin+0x1c36a7) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    100    [#1](/bitcoin-bitcoin/1/) std::__new_allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::allocate(unsigned long, void const*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27 (test_bitcoin+0xdbdd38) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    101    [#2](/bitcoin-bitcoin/2/) std::allocator_traits<std::allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>>::allocate(std::allocator<std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20 (test_bitcoin+0xdbdd38)
    102    [#3](/bitcoin-bitcoin/3/) std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_get_node() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:561:16 (test_bitcoin+0xdbdd38)
    103    [#4](/bitcoin-bitcoin/4/) std::_Rb_tree_node<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>* std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_create_node<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:611:23 (test_bitcoin+0xdbdd38)
    104    [#5](/bitcoin-bitcoin/5/) std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_Auto_node::_Auto_node<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>&, std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:1636:18 (test_bitcoin+0xdbdd38)
    105    [#6](/bitcoin-bitcoin/6/) std::_Rb_tree_iterator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>> std::_Rb_tree<uint256, std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>, std::_Select1st<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<uint256&&>, std::tuple<>>(std::_Rb_tree_const_iterator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>, std::piecewise_construct_t const&, std::tuple<uint256&&>&&, std::tuple<>&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:2461:13 (test_bitcoin+0xdbdd38)
    106    [#7](/bitcoin-bitcoin/7/) std::map<uint256, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>, std::less<uint256>, std::allocator<std::pair<uint256 const, std::unique_ptr<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>>>>::operator[](uint256&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_map.h:530:15 (test_bitcoin+0xd8d236) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    107    [#8](/bitcoin-bitcoin/8/) wallet::CWallet::SetupLegacyScriptPubKeyMan() src/wallet/wallet.cpp:3552:5 (test_bitcoin+0xd8d236)
    108    [#9](/bitcoin-bitcoin/9/) wallet::CWallet::GetOrCreateLegacyScriptPubKeyMan() src/wallet/wallet.cpp:3537:5 (test_bitcoin+0xd8fcdd) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    109    [#10](/bitcoin-bitcoin/10/) wallet::wallet_tests::WatchOnlyPubKeys::test_method() src/wallet/test/wallet_tests.cpp:495:47 (test_bitcoin+0xb6854b) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    110    [#11](/bitcoin-bitcoin/11/) wallet::wallet_tests::WatchOnlyPubKeys_invoker() src/wallet/test/wallet_tests.cpp:491:1 (test_bitcoin+0xb67fe2) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    111    [#12](/bitcoin-bitcoin/12/) boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (test_bitcoin+0x2edd5d) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    112    [#13](/bitcoin-bitcoin/13/) boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x2629e8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    113    [#14](/bitcoin-bitcoin/14/) boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (test_bitcoin+0x2629e8)
    114    [#15](/bitcoin-bitcoin/15/) boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (test_bitcoin+0x2629e8)
    115    [#16](/bitcoin-bitcoin/16/) boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x1e3a63) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    116    [#17](/bitcoin-bitcoin/17/) int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (test_bitcoin+0x1e3a63)
    117    [#18](/bitcoin-bitcoin/18/) boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (test_bitcoin+0x1e3a63)
    118    [#19](/bitcoin-bitcoin/19/) boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (test_bitcoin+0x1e3e1a) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    119    [#20](/bitcoin-bitcoin/20/) boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (test_bitcoin+0x1df504) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    120    [#21](/bitcoin-bitcoin/21/) boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (test_bitcoin+0x1df504)
    121    [#22](/bitcoin-bitcoin/22/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (test_bitcoin+0x217c0e) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    122    [#23](/bitcoin-bitcoin/23/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    123    [#24](/bitcoin-bitcoin/24/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    124    [#25](/bitcoin-bitcoin/25/) boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1722:29 (test_bitcoin+0x1de218) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    125    [#26](/bitcoin-bitcoin/26/) boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (test_bitcoin+0x1fbd28) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    126    [#27](/bitcoin-bitcoin/27/) main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (test_bitcoin+0x1fc2c3) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    127  Mutex M0 (0x7fff581e2118) created at:
    128    [#0](/bitcoin-bitcoin/0/) pthread_mutex_lock <null> (test_bitcoin+0x13da7b) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    129    [#1](/bitcoin-bitcoin/1/) __gthread_mutex_lock(pthread_mutex_t*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/gthr-default.h:749:12 (test_bitcoin+0xd87e9b) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    130    [#2](/bitcoin-bitcoin/2/) __gthread_recursive_mutex_lock(pthread_mutex_t*) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/x86_64-linux-gnu/c++/12/bits/gthr-default.h:811:10 (test_bitcoin+0xd87e9b)
    131    [#3](/bitcoin-bitcoin/3/) std::recursive_mutex::lock() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/mutex:108:17 (test_bitcoin+0xd87e9b)
    132    [#4](/bitcoin-bitcoin/4/) std::unique_lock<std::recursive_mutex>::lock() /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_lock.h:139:17 (test_bitcoin+0xd87e9b)
    133    [#5](/bitcoin-bitcoin/5/) UniqueLock<AnnotatedMixin<std::recursive_mutex>>::Enter(char const*, char const*, int) src/./sync.h:164:15 (test_bitcoin+0xd87e9b)
    134    [#6](/bitcoin-bitcoin/6/) UniqueLock<AnnotatedMixin<std::recursive_mutex>>::UniqueLock(AnnotatedMixin<std::recursive_mutex>&, char const*, char const*, int, bool) src/./sync.h:183:13 (test_bitcoin+0xd87e9b)
    135    [#7](/bitcoin-bitcoin/7/) wallet::CWallet::LoadWallet() src/wallet/wallet.cpp:2350:5 (test_bitcoin+0xd87e9b)
    136    [#8](/bitcoin-bitcoin/8/) wallet::WalletTestingSetup::WalletTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) src/wallet/test/wallet_test_fixture.cpp:15:14 (test_bitcoin+0x268bbc) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    137    [#9](/bitcoin-bitcoin/9/) wallet::wallet_tests::ComputeTimeSmart::ComputeTimeSmart() src/wallet/test/wallet_tests.cpp:407:1 (test_bitcoin+0xb6423d) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    138    [#10](/bitcoin-bitcoin/10/) wallet::wallet_tests::ComputeTimeSmart_invoker() src/wallet/test/wallet_tests.cpp:407:1 (test_bitcoin+0xb6423d)
    139    [#11](/bitcoin-bitcoin/11/) boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (test_bitcoin+0x2edd5d) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    140    [#12](/bitcoin-bitcoin/12/) boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x2629e8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    141    [#13](/bitcoin-bitcoin/13/) boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (test_bitcoin+0x2629e8)
    142    [#14](/bitcoin-bitcoin/14/) boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (test_bitcoin+0x2629e8)
    143    [#15](/bitcoin-bitcoin/15/) boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x1e3a63) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    144    [#16](/bitcoin-bitcoin/16/) int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (test_bitcoin+0x1e3a63)
    145    [#17](/bitcoin-bitcoin/17/) boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (test_bitcoin+0x1e3a63)
    146    [#18](/bitcoin-bitcoin/18/) boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (test_bitcoin+0x1e3e1a) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    147    [#19](/bitcoin-bitcoin/19/) boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (test_bitcoin+0x1df504) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    148    [#20](/bitcoin-bitcoin/20/) boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (test_bitcoin+0x1df504)
    149    [#21](/bitcoin-bitcoin/21/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (test_bitcoin+0x217c0e) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    150    [#22](/bitcoin-bitcoin/22/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    151    [#23](/bitcoin-bitcoin/23/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    152    [#24](/bitcoin-bitcoin/24/) boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1722:29 (test_bitcoin+0x1de218) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    153    [#25](/bitcoin-bitcoin/25/) boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (test_bitcoin+0x1fbd28) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    154    [#26](/bitcoin-bitcoin/26/) main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (test_bitcoin+0x1fc2c3) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    155  Thread T19 'b-scheduler' (tid=31659, running) created by main thread at:
    156    [#0](/bitcoin-bitcoin/0/) pthread_create <null> (test_bitcoin+0x13bdeb) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    157    [#1](/bitcoin-bitcoin/1/) std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) <null> (libstdc++.so.6+0xdc548) (BuildId: d8f370a6195f115a4e221070f20de2c68d281b66)
    158    [#2](/bitcoin-bitcoin/2/) TestingSetup::TestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<char const*, std::allocator<char const*>> const&, bool, bool) src/test/util/setup_common.cpp:243:7 (test_bitcoin+0xc178bf) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    159    [#3](/bitcoin-bitcoin/3/) wallet::WalletTestingSetup::WalletTestingSetup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) src/wallet/test/wallet_test_fixture.cpp:11:7 (test_bitcoin+0x268a3f) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    160    [#4](/bitcoin-bitcoin/4/) wallet::wallet_tests::WatchOnlyPubKeys::WatchOnlyPubKeys() src/wallet/test/wallet_tests.cpp:491:1 (test_bitcoin+0xb67bbd) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    161    [#5](/bitcoin-bitcoin/5/) wallet::wallet_tests::WatchOnlyPubKeys_invoker() src/wallet/test/wallet_tests.cpp:491:1 (test_bitcoin+0xb67bbd)
    162    [#6](/bitcoin-bitcoin/6/) boost::detail::function::void_function_invoker0<void (*)(), void>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:117:11 (test_bitcoin+0x2edd5d) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    163    [#7](/bitcoin-bitcoin/7/) boost::function0<void>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x2629e8) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    164    [#8](/bitcoin-bitcoin/8/) boost::detail::forward::operator()() /usr/include/boost/test/impl/execution_monitor.ipp:1388:32 (test_bitcoin+0x2629e8)
    165    [#9](/bitcoin-bitcoin/9/) boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) /usr/include/boost/function/function_template.hpp:137:18 (test_bitcoin+0x2629e8)
    166    [#10](/bitcoin-bitcoin/10/) boost::function0<int>::operator()() const /usr/include/boost/function/function_template.hpp:763:14 (test_bitcoin+0x1e3a63) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    167    [#11](/bitcoin-bitcoin/11/) int boost::detail::do_invoke<boost::shared_ptr<boost::detail::translator_holder_base>, boost::function<int ()>>(boost::shared_ptr<boost::detail::translator_holder_base> const&, boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:301:30 (test_bitcoin+0x1e3a63)
    168    [#12](/bitcoin-bitcoin/12/) boost::execution_monitor::catch_signals(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:903:16 (test_bitcoin+0x1e3a63)
    169    [#13](/bitcoin-bitcoin/13/) boost::execution_monitor::execute(boost::function<int ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1301:16 (test_bitcoin+0x1e3e1a) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    170    [#14](/bitcoin-bitcoin/14/) boost::execution_monitor::vexecute(boost::function<void ()> const&) /usr/include/boost/test/impl/execution_monitor.ipp:1397:5 (test_bitcoin+0x1df504) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    171    [#15](/bitcoin-bitcoin/15/) boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned long) /usr/include/boost/test/impl/unit_test_monitor.ipp:49:9 (test_bitcoin+0x1df504)
    172    [#16](/bitcoin-bitcoin/16/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:815:44 (test_bitcoin+0x217c0e) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    173    [#17](/bitcoin-bitcoin/17/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    174    [#18](/bitcoin-bitcoin/18/) boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned long, boost::unit_test::framework::state::random_generator_helper const*) /usr/include/boost/test/impl/framework.ipp:740:54 (test_bitcoin+0x217e20) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    175    [#19](/bitcoin-bitcoin/19/) boost::unit_test::framework::run(unsigned long, bool) /usr/include/boost/test/impl/framework.ipp:1722:29 (test_bitcoin+0x1de218) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    176    [#20](/bitcoin-bitcoin/20/) boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) /usr/include/boost/test/impl/unit_test_main.ipp:250:9 (test_bitcoin+0x1fbd28) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    177    [#21](/bitcoin-bitcoin/21/) main /usr/include/boost/test/impl/unit_test_main.ipp:306:12 (test_bitcoin+0x1fc2c3) (BuildId: 6e7a01ec663618406e731a1fbcd28edb47544ffe)
    178SUMMARY: ThreadSanitizer: data race /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:191:51 in std::__uniq_ptr_impl<wallet::ScriptPubKeyMan, std::default_delete<wallet::ScriptPubKeyMan>>::_M_ptr() const
    179==================
    180make[3]: *** [Makefile:21823: wallet/test/wallet_tests.cpp.test] Error 1
    181make[3]: *** Waiting for unfinished jobs....
    182make[3]: Leaving directory '/tmp/cirrus-ci-build/bitcoin-core/src'
    183make[2]: *** [Makefile:19828: check-am] Error 2
    184make[2]: Leaving directory '/tmp/cirrus-ci-build/bitcoin-core/src'
    185make[1]: *** [Makefile:19493: check-recursive] Error 1
    186make[1]: Leaving directory '/tmp/cirrus-ci-build/bitcoin-core/src'
    187make: *** [Makefile:816: check-recursive] Error 1
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    current master

    Operating system and version

    debian:experimental

    Machine specifications

    clang-16, lib/gcc-12

  2. maflcko added the label Bug on Mar 28, 2023
  3. maflcko added the label Wallet on Mar 28, 2023
  4. furszy commented at 1:19 pm on March 31, 2023: member

    However, I think this may also happen in production, so a proper fix would be to protect m_spk_managers with a mutex? If not, it might be sufficient to add a SyncWithValidationInterfaceQueue() somewhere in the test.

    It is hard for this race to occur in production due to the wallet registering to the validation interface after loading, which means that the legacy spkm exists before any chain event takes place. However, other races may still occur. Furthermore, the spkm maps are guarded by cs_wallet in some instances, but not in others.

    The root cause of this issue is our misuse (and abuse) of the recursive lock. We typically lock the mutex at the beginning of a process, without considering how many times the lock might be relocked internally. Some wallet methods are already depending on it, so they don’t lock the mutex (and add the exclusive lock requirement annotation), while others that are used externally lock the mutex.

    To address this specific test-only issue, the fix can be straightforward: we just need to add the missing cs_wallet to the setup function or the lock requirement annotation (and ensure the lock in the caller side) or.. as you said, even call to the sync validation queue at the base wallet test class. However, the long-term solution is more complex. We cannot add the guarded_by annotation to the spkm maps because doing so would unchain a large number of missing locks, which will be difficult to fix without either recurring to lock the mutex recursively or.. create two separate methods: one that locks the mutex internally and one that only executes if the lock has already been acquired.

    Will jump into this rabbit hole in the coming week/s and see how much can be cleaned/reorganized in a first round.

  5. maflcko added the label CI failed on Feb 8, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-03 15:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me