Segmentation fault in the scheduler thread when an index fails to commit to the db #26068

issue MarcoFalke openend this issue on September 12, 2022
  1. MarcoFalke commented at 11:28 am on September 12, 2022: member

    See https://cirrus-ci.com/task/5413417262514176?logs=ci#L3188 :

    • First, it fails to commit (for some unknown reason): ERROR: Commit: Failed to commit latest coinstatsindex state
    • Then, it considers itself synced: coinstatsindex is enabled at height 100, coinstatsindex thread exit
    • Then, the scheduler thread segfaults.
      0...
      1
      22022-09-12T10:55:06.800147Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2060] [ConnectBlock] [bench]     - Sanity checks: 0.00ms [0.00s (0.01ms/blk)]
      32022-09-12T10:55:06.800227Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2159] [ConnectBlock] [bench]     - Fork checks: 0.08ms [0.23s (0.57ms/blk)]
      42022-09-12T10:55:06.800311Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2244] [ConnectBlock] [bench]       - Connect 1 transactions: 0.08ms (0.076ms/tx, 0.000ms/txin) [0.04s (0.10ms/blk)]
      52022-09-12T10:55:06.800399Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2257] [ConnectBlock] [bench]     - Verify 0 txins: 0.17ms (0.000ms/txin) [0.09s (0.23ms/blk)]
      62022-09-12T10:55:06.800528Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2267] [ConnectBlock] [bench]     - Write undo data: 0.13ms [0.03s (0.07ms/blk)]
      72022-09-12T10:55:06.800590Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2278] [ConnectBlock] [bench]     - Index writing: 0.07ms [0.02s (0.04ms/blk)]
      82022-09-12T10:55:06.800692Z (mocktime: 2020-08-31T15:34:11Z) [test] [validationinterface.cpp:252] [BlockChecked] [validation] BlockChecked: block hash=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 state=Valid
      92022-09-12T10:55:06.800760Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2729] [ConnectTip] [bench]   - Connect total: 0.71ms [0.18s (0.45ms/blk)]
     102022-09-12T10:55:06.800820Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2734] [ConnectTip] [bench]   - Flush: 0.06ms [0.05s (0.12ms/blk)]
     112022-09-12T10:55:06.800920Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2740] [ConnectTip] [bench]   - Writing chainstate: 0.09ms [0.02s (0.04ms/blk)]
     122022-09-12T10:55:06.801517Z (mocktime: 2020-08-31T15:34:11Z) [test] [policy/fees.cpp:667] [processBlock] [estimatefee] Blockpolicy estimates updated by 0 of 0 block txs, since last block 0 of 0 tracked, mempool map size 0, max target 0 from current
     132022-09-12T10:55:06.801640Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2519] [UpdateTipLog] UpdateTip: new best=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 height=100 version=0x20000000 log2_work=7.658211 tx=101 date='2020-08-31T15:34:11Z' progress=1.000000 cache=0.0MiB(100txo)
     142022-09-12T10:55:06.801701Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2751] [ConnectTip] [bench]   - Connect postprocess: 0.78ms [0.34s (0.83ms/blk)]
     152022-09-12T10:55:06.801755Z (mocktime: 2020-08-31T15:34:11Z) [test] [validation.cpp:2752] [ConnectTip] [bench] - Connect block: 1.72ms [0.75s (1.85ms/blk)]
     162022-09-12T10:55:06.801819Z (mocktime: 2020-08-31T15:34:11Z) [test] [txmempool.cpp:706] [check] [mempool] Checking mempool with 0 transactions and 0 inputs
     172022-09-12T10:55:06.801952Z (mocktime: 2020-08-31T15:34:11Z) [test] [validationinterface.cpp:229] [BlockConnected] [validation] Enqueuing BlockConnected: block hash=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 block height=100
     182022-09-12T10:55:06.802069Z (mocktime: 2020-08-31T15:34:11Z) [scheduler] [validationinterface.cpp:229] [operator()] [validation] BlockConnected: block hash=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 block height=100
     192022-09-12T10:55:06.802183Z (mocktime: 2020-08-31T15:34:11Z) [test] [validationinterface.cpp:202] [UpdatedBlockTip] [validation] Enqueuing UpdatedBlockTip: new block hash=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 fork block hash=68aef0c7c1c2cc15ca20a558ea1d6e66aecc1d6398bddea75e4c031cb79cc07e (in IBD=false)
     202022-09-12T10:55:06.802295Z (mocktime: 2020-08-31T15:34:11Z) [scheduler] [validationinterface.cpp:202] [operator()] [validation] UpdatedBlockTip: new block hash=571d80a9967ae599cec0448b0b0ba1cfb606f584d8069bd7166b86854ba7a191 fork block hash=68aef0c7c1c2cc15ca20a558ea1d6e66aecc1d6398bddea75e4c031cb79cc07e (in IBD=false)
     212022-09-12T10:55:06.803313Z (mocktime: 2020-08-31T15:34:12Z) [test] [dbwrapper.cpp:158] [CDBWrapper] Opened LevelDB successfully
     222022-09-12T10:55:06.803450Z (mocktime: 2020-08-31T15:34:12Z) [test] [dbwrapper.cpp:183] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/7b9ce9462bbe925416385de4a76d6cf557607ae446c058cb3eba456ddb39ce92/regtest/indexes/coinstats/db: 0000000000000000
     232022-09-12T10:55:06.804336Z (mocktime: 2020-08-31T15:34:12Z) [coinstatsindex] [util/thread.cpp:18] [TraceThread] coinstatsindex thread start
     242022-09-12T10:55:06.804462Z (mocktime: 2020-08-31T15:34:12Z) [coinstatsindex] [index/base.cpp:186] [ThreadSync] Syncing coinstatsindex with block chain from height 0
     252022-09-12T10:55:06.804547Z (mocktime: 2020-08-31T15:34:12Z) [coinstatsindex] [util/system.h:50] [error] ERROR: Commit: Failed to commit latest coinstatsindex state
     262022-09-12T10:55:09.607921Z (mocktime: 2020-08-31T15:34:12Z) [coinstatsindex] [index/base.cpp:215] [ThreadSync] coinstatsindex is enabled at height 100
     272022-09-12T10:55:09.608000Z (mocktime: 2020-08-31T15:34:12Z) [coinstatsindex] [util/thread.cpp:20] [TraceThread] coinstatsindex thread exit
     282022-09-12T10:55:09.608444Z (mocktime: 2020-08-31T15:34:12Z) [test] [node/miner.cpp:163] [CreateNewBlock] CreateNewBlock(): block weight: 940 txs: 0 fees: 0 sigops 400
     292022-09-12T10:55:09.608651Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2060] [ConnectBlock] [bench]     - Sanity checks: 0.01ms [0.00s (0.01ms/blk)]
     302022-09-12T10:55:09.608752Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2159] [ConnectBlock] [bench]     - Fork checks: 0.11ms [0.23s (0.57ms/blk)]
     312022-09-12T10:55:09.608860Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2244] [ConnectBlock] [bench]       - Connect 1 transactions: 0.09ms (0.088ms/tx, 0.000ms/txin) [0.04s (0.10ms/blk)]
     322022-09-12T10:55:09.608974Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2257] [ConnectBlock] [bench]     - Verify 0 txins: 0.22ms (0.000ms/txin) [0.10s (0.23ms/blk)]
     332022-09-12T10:55:09.609051Z (mocktime: 2020-08-31T15:34:12Z) [test] [node/miner.cpp:178] [CreateNewBlock] [bench] CreateNewBlock() packages: 0.05ms (0 packages, 0 updated descendants), validity: 0.69ms (total 0.74ms)
     342022-09-12T10:55:09.609767Z (mocktime: 2020-08-31T15:34:12Z) [test] [validationinterface.cpp:257] [NewPoWValidBlock] [validation] NewPoWValidBlock: block hash=0e146357c1f82a8b9e2c54cb53a619a0ffbcace90d33ad228dc0ef44752b6844
     352022-09-12T10:55:09.610524Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2710] [ConnectTip] [bench]   - Using cached block
     362022-09-12T10:55:09.610601Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2717] [ConnectTip] [bench]   - Load block from disk: 0.07ms [0.16s (0.41ms/blk)]
     372022-09-12T10:55:09.610702Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2060] [ConnectBlock] [bench]     - Sanity checks: 0.00ms [0.00s (0.01ms/blk)]
     382022-09-12T10:55:09.610794Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2159] [ConnectBlock] [bench]     - Fork checks: 0.09ms [0.23s (0.57ms/blk)]
     392022-09-12T10:55:09.610920Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2244] [ConnectBlock] [bench]       - Connect 1 transactions: 0.10ms (0.096ms/tx, 0.000ms/txin) [0.04s (0.10ms/blk)]
     402022-09-12T10:55:09.611012Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2257] [ConnectBlock] [bench]     - Verify 0 txins: 0.21ms (0.000ms/txin) [0.10s (0.23ms/blk)]
     412022-09-12T10:55:09.611151Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2267] [ConnectBlock] [bench]     - Write undo data: 0.14ms [0.03s (0.07ms/blk)]
     422022-09-12T10:55:09.611217Z (mocktime: 2020-08-31T15:34:12Z) [test] [validation.cpp:2278] [ConnectBlock] [bench]     - Index writing: 0.07ms [0.02s (0.04ms/blk)]
     432022-09-12T10:55:09.611296Z (mocktime: 2020-08-31T15:34:12Z) [test] [valiThreadSanitizer:DEADLYSIGNAL
     44make[3]: *** [Makefile:21202: test/coinstatsindex_tests.cpp.test] Error 1
     45make[3]: *** Waiting for unfinished jobs....
     46PASS: qt/test/test_bitcoin-qt
     47============================================================================
     48Testsuite summary for Bitcoin Core 23.99.0
     49============================================================================
     50# TOTAL: 4
     51# PASS:  4
     52# SKIP:  0
     53# XFAIL: 0
     54# FAIL:  0
     55# XPASS: 0
     56# ERROR: 0
     57============================================================================
     58make[4]: Leaving directory '/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src'
     59make[3]: Leaving directory '/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src'
     60make[2]: *** [Makefile:19260: check-am] Error 2
     61make[2]: Leaving directory '/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src'
     62make[1]: *** [Makefile:18926: check-recursive] Error 1
     63make[1]: Leaving directory '/tmp/cirrus-ci-build/ci/scratch/build/bitcoin-x86_64-pc-linux-gnu/src'
     64make: *** [Makefile:824: check-recursive] Error 1
     65==25198==ERROR: ThreadSanitizer: SEGV on unknown address 0x000000000068 (pc 0x55e8c6500aeb bp 0x7b1400009548 sp 0x7fdf23d0ec80 T25670)
     66==25198==The signal is caused by a READ memory access.
     67==25198==Hint: address points to the zero page.
     68    [#0](/bitcoin-bitcoin/0/) BaseIndex::SetBestBlockIndex(CBlockIndex const*)::$_1::operator()() const src/index/base.cpp:418:9 (test_bitcoin+0xd78aeb)
     69    [#1](/bitcoin-bitcoin/1/) BaseIndex::SetBestBlockIndex(CBlockIndex const*) src/index/base.cpp:418:9 (test_bitcoin+0xd78aeb)
     70    [#2](/bitcoin-bitcoin/2/) BaseIndex::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*) src/index/base.cpp:298:9 (test_bitcoin+0xd7ae5b)
     71    [#3](/bitcoin-bitcoin/3/) CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_8::operator()() const::'lambda'(CValidationInterface&)::operator()(CValidationInterface&) const src/validationinterface.cpp:225:79 (test_bitcoin+0x10f0f54)
     72    [#4](/bitcoin-bitcoin/4/) void MainSignalsImpl::Iterate<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_8::operator()() const::'lambda'(CValidationInterface&)>(CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_8::operator()() const::'lambda'(CValidationInterface&)&&) src/validationinterface.cpp:86:17 (test_bitcoin+0x10f0f54)
     73    [#5](/bitcoin-bitcoin/5/) CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_8::operator()() const src/validationinterface.cpp:225:22 (test_bitcoin+0x10f0f54)
     74    [#6](/bitcoin-bitcoin/6/) CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9::operator()() const src/validationinterface.cpp:227:5 (test_bitcoin+0x10f0f54)
     75    [#7](/bitcoin-bitcoin/7/) decltype(static_cast<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9&>(fp)()) std::__1::__invoke<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9&>(CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9&) /usr/lib/llvm-13/bin/../include/c++/v1/type_traits:3918:1 (test_bitcoin+0x10f0f54)
     76    [#8](/bitcoin-bitcoin/8/) void std::__1::__invoke_void_return_wrapper<void, true>::__call<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9&>(CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9&) /usr/lib/llvm-13/bin/../include/c++/v1/__functional/invoke.h:61:9 (test_bitcoin+0x10f0f54)
     77    [#9](/bitcoin-bitcoin/9/) std::__1::__function::__alloc_func<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9, std::__1::allocator<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:171:16 (test_bitcoin+0x10f0f54)
     78    [#10](/bitcoin-bitcoin/10/) std::__1::__function::__func<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9, std::__1::allocator<CMainSignals::BlockConnected(std::__1::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_9>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:345:12 (test_bitcoin+0x10f0f54)
     79    [#11](/bitcoin-bitcoin/11/) std::__1::__function::__value_func<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:498:16 (test_bitcoin+0x118bc01)
     80    [#12](/bitcoin-bitcoin/12/) std::__1::function<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:1175:12 (test_bitcoin+0x118bc01)
     81    [#13](/bitcoin-bitcoin/13/) SingleThreadedSchedulerClient::ProcessQueue() src/scheduler.cpp:175:5 (test_bitcoin+0x118bc01)
     82    [#14](/bitcoin-bitcoin/14/) SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1::operator()() const src/scheduler.cpp:144:41 (test_bitcoin+0x118d915)
     83    [#15](/bitcoin-bitcoin/15/) decltype(static_cast<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1&>(fp)()) std::__1::__invoke<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1&>(SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1&) /usr/lib/llvm-13/bin/../include/c++/v1/type_traits:3918:1 (test_bitcoin+0x118d915)
     84    [#16](/bitcoin-bitcoin/16/) void std::__1::__invoke_void_return_wrapper<void, true>::__call<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1&>(SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1&) /usr/lib/llvm-13/bin/../include/c++/v1/__functional/invoke.h:61:9 (test_bitcoin+0x118d915)
     85    [#17](/bitcoin-bitcoin/17/) std::__1::__function::__alloc_func<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1, std::__1::allocator<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:171:16 (test_bitcoin+0x118d915)
     86    [#18](/bitcoin-bitcoin/18/) std::__1::__function::__func<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1, std::__1::allocator<SingleThreadedSchedulerClient::MaybeScheduleProcessQueue()::$_1>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:345:12 (test_bitcoin+0x118d915)
     87    [#19](/bitcoin-bitcoin/19/) std::__1::__function::__value_func<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:498:16 (test_bitcoin+0x118abec)
     88    [#20](/bitcoin-bitcoin/20/) std::__1::function<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:1175:12 (test_bitcoin+0x118abec)
     89    [#21](/bitcoin-bitcoin/21/) CScheduler::serviceQueue() src/scheduler.cpp:62:17 (test_bitcoin+0x118abec)
     90    [#22](/bitcoin-bitcoin/22/) ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0::operator()() const src/test/util/setup_common.cpp:186:110 (test_bitcoin+0xab5148)
     91    [#23](/bitcoin-bitcoin/23/) decltype(static_cast<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&>(fp)()) std::__1::__invoke<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&>(ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&) /usr/lib/llvm-13/bin/../include/c++/v1/type_traits:3918:1 (test_bitcoin+0xab5148)
     92    [#24](/bitcoin-bitcoin/24/) void std::__1::__invoke_void_return_wrapper<void, true>::__call<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&>(ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&) /usr/lib/llvm-13/bin/../include/c++/v1/__functional/invoke.h:61:9 (test_bitcoin+0xab5148)
     93    [#25](/bitcoin-bitcoin/25/) std::__1::__function::__alloc_func<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0, std::__1::allocator<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:171:16 (test_bitcoin+0xab5148)
     94    [#26](/bitcoin-bitcoin/26/) std::__1::__function::__func<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0, std::__1::allocator<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0>, void ()>::operator()() /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:345:12 (test_bitcoin+0xab5148)
     95    [#27](/bitcoin-bitcoin/27/) std::__1::__function::__value_func<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:498:16 (test_bitcoin+0x124b1af)
     96    [#28](/bitcoin-bitcoin/28/) std::__1::function<void ()>::operator()() const /usr/lib/llvm-13/bin/../include/c++/v1/__functional/function.h:1175:12 (test_bitcoin+0x124b1af)
     97    [#29](/bitcoin-bitcoin/29/) util::TraceThread(char const*, std::__1::function<void ()>) src/util/thread.cpp:19:9 (test_bitcoin+0x124b1af)
     98    [#30](/bitcoin-bitcoin/30/) decltype(static_cast<void (*>(fp)(static_cast<char const*>(fp0), static_cast<ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0>(fp0))) std::__1::__invoke<void (*)(char const*, std::__1::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0>(void (*&&)(char const*, std::__1::function<void ()>), char const*&&, ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0&&) /usr/lib/llvm-13/bin/../include/c++/v1/type_traits:3918:1 (test_bitcoin+0xab4d41)
     99    [#31](/bitcoin-bitcoin/31/) void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(char const*, std::__1::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0, 2ul, 3ul>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(char const*, std::__1::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0>&, std::__1::__tuple_indices<2ul, 3ul>) /usr/lib/llvm-13/bin/../include/c++/v1/thread:280:5 (test_bitcoin+0xab4d41)
    100    [#32](/bitcoin-bitcoin/32/) void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(char const*, std::__1::function<void ()>), char const*, ChainTestingSetup::ChainTestingSetup(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::vector<char const*, std::__1::allocator<char const*> > const&)::$_0> >(void*) /usr/lib/llvm-13/bin/../include/c++/v1/thread:291:5 (test_bitcoin+0xab4d41)
    101    [#33](/bitcoin-bitcoin/33/) __tsan_thread_start_func <null> (test_bitcoin+0x13319c)
    102    [#34](/bitcoin-bitcoin/34/) <null> <null> (libc.so.6+0x94b42)
    103    [#35](/bitcoin-bitcoin/35/) <null> <null> (libc.so.6+0x1269ff)
    104ThreadSanitizer can not provide additional info.
    105SUMMARY: ThreadSanitizer: SEGV src/index/base.cpp:418:9 in BaseIndex::SetBestBlockIndex(CBlockIndex const*)::$_1::operator()() const
    106==25198==ABORTING
    107Exit status: 2
    
  2. MarcoFalke added the label Bug on Sep 12, 2022
  3. MarcoFalke added the label UTXO Db and Indexes on Sep 12, 2022
  4. mzumsande commented at 3:19 pm on September 12, 2022: contributor
    Looks similar to #25632.
  5. MarcoFalke added this to the milestone 24.0 on Sep 12, 2022
  6. vasild commented at 9:10 am on September 16, 2022: contributor

    Did this only happen once on commit fa7b5ca1981c641d10ab959463961e6ba727cee1 from #24737?

    I don’t get it why is it crashing on this line:

    0        WITH_LOCK(::cs_main, m_chainstate->m_blockman.UpdatePruneLock(GetName(), prune_lock));
    

    I would change that line to:

    0        LOCK(::cs_main);
    1        const char* name = GetName();
    2        assert(name != nullptr);
    3        assert(m_chainstate != nullptr);
    4        m_chainstate->m_blockman.UpdatePruneLock(name, prune_lock);
    

    GetName() is pure virtual method in the BaseIndex class. In frame #3:

    0224     auto event = [pblock, pindex, this] {
    1225         m_internals->Iterate([&](CValidationInterface& callbacks) { callbacks.BlockConnected(pblock, pindex); });
    2226     };
    

    the construct callbacks.BlockConnected seems to call BaseIndex::BlockConnected() (frame #2). I find this code hard to follow.

  7. MarcoFalke commented at 10:06 am on September 16, 2022: member
    Also related: #25365
  8. MarcoFalke removed this from the milestone 24.0 on Sep 16, 2022
  9. vasild commented at 10:18 am on September 16, 2022: contributor

    Also related: #25365

    In that report, the crash is happening on src/index/base.cpp:388 from an unmerged/old incarnation of #25364: b02411d2ddf8c010fc4e9d9ec27cae3a73e895a9. That is the same line:

    0WITH_LOCK(::cs_main, m_chainstate->m_blockman.UpdatePruneLock(GetName(), prune_lock));
    
  10. vasild commented at 11:52 am on September 16, 2022: contributor

    Same test as in #25365: coinstatsindex_initial_sync, from OP:

    https://cirrus-ci.com/task/5413417262514176?logs=ci#L339

    test/coinstatsindex_tests.cpp(30): Entering test case “coinstatsindex_initial_sync”

  11. MarcoFalke commented at 12:26 pm on September 16, 2022: member
    Yes, same as #25365
  12. MarcoFalke closed this on Sep 16, 2022

  13. bitcoin locked this on Sep 16, 2023

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-10-31 03:12 UTC

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