Illegal Instruction in `CoinStatsIndex::CustomAppend` #30402

issue achow101 opened this issue on July 6, 2024
  1. achow101 commented at 2:35 AM on July 6, 2024: member

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    While reindexing a signet node with all indexes enabled, SIGILL occurs and Bitcoin Core crashes.

    Expected behaviour

    Not crash

    Steps to reproduce

    Do bitcoind -signet -coinstatsindex -reindex.

    Unsure if this would happen on a sync from scratch or if the index did not previously exist (I'd assume so though).

    Relevant log output

    Thread 76 "b-scheduler" received signal SIGILL, Illegal instruction.
    [Switching to Thread 0x7fff59a006c0 (LWP 380375)]
    0x0000555556025bb2 in CoinStatsIndex::CustomAppend (this=0x7ffe576f5580, block=...) at ../../../src/index/coinstatsindex.cpp:212
    212	   const CAmount unclaimed_rewards{(m_total_prevout_spent_amount + m_total_subsidy) - (m_total_new_outputs_ex_coinbase_amount + m_total_coinbase_amount + m_total_unspendable_amount)};
    (gdb) bt
    [#0](/bitcoin-bitcoin/0/)  0x0000555556025bb2 in CoinStatsIndex::CustomAppend (this=0x7ffe576f5580, block=...) at ../../../src/index/coinstatsindex.cpp:212
    [#1](/bitcoin-bitcoin/1/)  0x00005555560075c2 in BaseIndex::BlockConnected
        (this=0x7ffe576f5580, role=ChainstateRole::NORMAL, block=std::shared_ptr<const CBlock> (use count 2, weak count 0) = {...}, pindex=0x7ffe55714498)
        at ../../../src/index/base.cpp:314
    [#2](/bitcoin-bitcoin/2/)  0x0000555555f38d9e in ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::{lambda(CValidationInterface&)#1}::operator()(CValidationInterface&) const (this=0x7fff599ff000, callbacks=...) at ../../../src/validationinterface.cpp:208
    [#3](/bitcoin-bitcoin/3/)  0x0000555555f38b68 in ValidationSignalsImpl::Iterate<ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::{lambda(CValidationInterface&)#1}>(ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const::{lambda(CValidationInterface&)#1}&&) (this=0x555557c0a400, f=...) at ../../../src/validationinterface.cpp:88
    [#4](/bitcoin-bitcoin/4/)  0x0000555555f389f1 in ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_1::operator()() const
        (this=0x7ffda2a0c930) at ../../../src/validationinterface.cpp:208
    [#5](/bitcoin-bitcoin/5/)  0x0000555555f38943 in ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0::operator()() const
        (this=0x7ffda2a0c910) at ../../../src/validationinterface.cpp:210
    [#6](/bitcoin-bitcoin/6/)  0x0000555555f386e2 in std::__invoke_impl<void, ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&>(std::__invoke_other, ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&) (__f=...)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:61
    [#7](/bitcoin-bitcoin/7/)  0x0000555555f38642 in std::__invoke_r<void, ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&>(ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0&) (__fn=...)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:111
    [#8](/bitcoin-bitcoin/8/)  0x0000555555f3837e in std::_Function_handler<void (), ValidationSignals::BlockConnected(ChainstateRole, std::shared_ptr<CBlock const> const&, CBlockIndex const*)::$_0>::_M_invoke(std::_Any_data const&) (__functor=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:290
    [#9](/bitcoin-bitcoin/9/)  0x0000555555711fec in std::function<void ()>::operator()() const (this=0x7fff599ff248)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:591
    [#10](/bitcoin-bitcoin/10/) 0x00005555565a4d77 in SerialTaskRunner::ProcessQueue (this=0x55555779ce00) at ../../../src/scheduler.cpp:173
    [#11](/bitcoin-bitcoin/11/) 0x00005555565a6c45 in SerialTaskRunner::MaybeScheduleProcessQueue()::$_0::operator()() const (this=0x7fff599ff3f8) at ../../../src/scheduler.cpp:142
    [#12](/bitcoin-bitcoin/12/) 0x00005555565a6bf2 in std::__invoke_impl<void, SerialTaskRunner::MaybeScheduleProcessQueue()::$_0&>(std::__invoke_other, SerialTaskRunner::MaybeScheduleProcessQueue()::$_0&) (__f=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:61
    [#13](/bitcoin-bitcoin/13/) 0x00005555565a6b42 in std::__invoke_r<void, SerialTaskRunner::MaybeScheduleProcessQueue()::$_0&>(SerialTaskRunner::MaybeScheduleProcessQueue()::$_0&) (__fn=...)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:111
    [#14](/bitcoin-bitcoin/14/) 0x00005555565a69de in std::_Function_handler<void (), SerialTaskRunner::MaybeScheduleProcessQueue()::$_0>::_M_invoke(std::_Any_data const&) (__functor=...)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:290
    [#15](/bitcoin-bitcoin/15/) 0x0000555555711fec in std::function<void ()>::operator()() const (this=0x7fff599ff3f8)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:591
    [#16](/bitcoin-bitcoin/16/) 0x00005555565a3fc1 in CScheduler::serviceQueue (this=0x7ffe54001ba0) at ../../../src/scheduler.cpp:60
    [#17](/bitcoin-bitcoin/17/) 0x00005555558dcac5 in AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12::operator()() const (this=0x7fff599ff798) at ../../../src/init.cpp:1170
    [#18](/bitcoin-bitcoin/18/) 0x00005555558dca72 in std::__invoke_impl<void, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&>(std::__invoke_other, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&) (__f=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:61
    [#19](/bitcoin-bitcoin/19/) 0x00005555558dc9c2 in std::__invoke_r<void, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&>(AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&) (__fn=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:111
    [#20](/bitcoin-bitcoin/20/) 0x00005555558dc85e in std::_Function_handler<void (), AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12>::_M_invoke(std::_Any_data const&)
        (__functor=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:290
    [#21](/bitcoin-bitcoin/21/) 0x0000555555711fec in std::function<void ()>::operator()() const (this=0x7fff599ff798)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_function.h:591
    [#22](/bitcoin-bitcoin/22/) 0x00005555560985d0 in util::TraceThread(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>) (thread_name="scheduler", thread_func=...)
        at ../../../src/util/thread.cpp:21
    [#23](/bitcoin-bitcoin/23/) 0x00005555558dc652 in std::__invoke_impl<void, void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12>(std::__invoke_other, void (*&&)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*&&, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&&)
        (__f=@0x7ffe54002738: 0x555556098470 <util::TraceThread(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>)>, __args=@0x7ffe54002730: 0x5555567f2dc4 "scheduler", __args=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:61
    [#24](/bitcoin-bitcoin/24/) 0x00005555558dc4d2 in std::__invoke<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12>(void (*&&)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*&&, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12&&)
        (__fn=@0x7ffe54002738: 0x555556098470 <util::TraceThread(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>)>, __args=@0x7ffe54002730: 0x5555567f2dc4 "scheduler", __args=...) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/invoke.h:96
    [#25](/bitcoin-bitcoin/25/) 0x00005555558dc470 in std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12> >::_M_invoke<0ul, 1ul, 2ul>(std::_Index_tuple<0ul, 1ul, 2ul>) (this=0x7ffe54002728)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_thread.h:292
    [#26](/bitcoin-bitcoin/26/) 0x00005555558dc3f2 in std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12> >::operator()() (this=0x7ffe54002728)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_thread.h:299
    [#27](/bitcoin-bitcoin/27/) 0x00005555558dc1aa in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(std::basic_string_view<char, std::char_traits<char> >, std::function<void ()>), char const*, AppInitMain(node::NodeContext&, interfaces::BlockAndHeaderTipInfo*)::$_12> > >::_M_run() (this=0x7ffe54002720)
        at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.1.1/../../../../include/c++/14.1.1/bits/std_thread.h:244
    [#28](/bitcoin-bitcoin/28/) 0x00007ffff64a3c84 in std::execute_native_thread_routine (__p=0x7ffe54002720) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
    [#29](/bitcoin-bitcoin/29/) 0x00007ffff6151ded in start_thread (arg=<optimized out>) at pthread_create.c:447
    [#30](/bitcoin-bitcoin/30/) 0x00007ffff61d50dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
    

    How did you obtain Bitcoin Core

    Compiled from source

    What version of Bitcoin Core are you using?

    bd5d1688b4311e21c0e0ff89a3ae02ef7d0543b8

    Operating system and version

    Arch

    Machine specifications

    No response

  2. achow101 added this to the milestone 28.0 on Jul 6, 2024
  3. mzumsande commented at 5:28 AM on July 6, 2024: contributor

    At what height did it crash? If the height was 112516, this is probably a duplicate of #26362.

  4. tdb3 commented at 2:46 PM on July 6, 2024: contributor

    Performed an IBD on bd5d1688b4311e21c0e0ff89a3ae02ef7d0543b8 from scratch (no signet dir, so no initial index). Did not see the issue on a non-debug build. Did encounter what looked to be the issue on a debug build at around height=112512

  5. achow101 commented at 4:02 PM on July 6, 2024: member

    At what height did it crash? If the height was 112516, this is probably a duplicate of #26362.

    Ah, indeed.

  6. achow101 closed this on Jul 6, 2024

  7. achow101 removed this from the milestone 28.0 on Jul 6, 2024
  8. bitcoin locked this on Jul 6, 2025

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: 2026-04-13 18:13 UTC

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