doc: Internal bug detected running listtransactions on OP_RETURN output #26338

issue dooglus openend this issue on October 19, 2022
  1. dooglus commented at 3:49 pm on October 19, 2022: contributor

    I saw an internal bug detected message running listtransactions:

    $ bitcoin-cli listtransactions '*' 500
    error code: -1
    error message:
    Internal bug detected: "std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [&ret](const RPCResult& res) { return res.MatchesType(ret); })"
    rpc/util.cpp:587 (HandleRequest)
    Please report this issue here: https://github.com/bitcoin/bitcoin/issues
    

    I narrowed it down to a particular transaction in my history:

    $ for i in {453..455}; do echo "--- $i ---"; bitcoin-cli listtransactions '*' 1 $i; done
    --- 453 ---
    [
      {
        "address": "bc1qnle0kjvz4wyju49m00krxztdqu5ygak00nft37",
        "category": "send",
        "amount": -1.26545600,
        "label": "",
        "vout": 0,
        "fee": -0.00006450,
        "confirmations": 253723,
        "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
        "blockheight": 505672,
        "blockindex": 857,
        "blocktime": 1516693344,
        "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
        "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
        "walletconflicts": [
        ],
        "time": 1516689935,
        "timereceived": 1516689935,
        "bip125-replaceable": "no",
        "abandoned": false
      }
    ]
    --- 454 ---
    error code: -1
    error message:
    Internal bug detected: "std::any_of(m_results.m_results.begin(), m_results.m_results.end(), [&ret](const RPCResult& res) { return res.MatchesType(ret); })"
    rpc/util.cpp:587 (HandleRequest)
    Please report this issue here: https://github.com/bitcoin/bitcoin/issues
    
    --- 455 ---
    [
      {
        "address": "bc1qnle0kjvz4wyju49m00krxztdqu5ygak00nft37",
        "parent_descs": [
        ],
        "category": "receive",
        "amount": 1.26545600,
        "label": "",
        "vout": 0,
        "confirmations": 253723,
        "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
        "blockheight": 505672,
        "blockindex": 857,
        "blocktime": 1516693344,
        "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
        "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
        "walletconflicts": [
        ],
        "time": 1516689935,
        "timereceived": 1516689935,
        "bip125-replaceable": "no"
      }
    ]
    

    Note how the txid on the two transactions surrounding the bad one are the same. the block explorer shows that this transaction has an OP_RETURN output, which is probably what is triggering this internal bug detection.

    System information

    I built bitcoin core from the git tag v24.0rc1. It’s running on a Debian Linux system, Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz, SSD.

  2. dooglus added the label Bug on Oct 19, 2022
  3. achow101 added this to the milestone 24.0 on Oct 19, 2022
  4. dooglus commented at 4:27 pm on October 19, 2022: contributor
    For the record I rebuilt against tag v24.0rc2 and nothing changed in the output other than the number of confirmations reported.
  5. maflcko added the label RPC/REST/ZMQ on Oct 19, 2022
  6. maflcko added the label Docs on Oct 19, 2022
  7. maflcko commented at 4:33 pm on October 19, 2022: member
    The doc check shouldn’t crash a production system. Did you compile with -DRPC_DOC_CHECK or --enable-debug?
  8. maflcko added the label Tests on Oct 19, 2022
  9. maflcko commented at 4:38 pm on October 19, 2022: member
    The doc check usually complains when a value is returned that is not documented, or a documented value is not returned. Can you share the output of crashing tx when you start the RPC server with -norpcdoccheck, or compile it with the debug setting disabled?
  10. dooglus commented at 5:05 pm on October 19, 2022: contributor

    I build using –enable-debug, yes.

    When I run bitcoin-qt -norpcdoccheck I get this error:

    Screenshot_2022-10-19_10-00-17

    followed by a sigsegv:

    Thread 1 "bitcoin-qt" received signal SIGSEGV, Segmentation fault.
    0x00007ffff664aef7 in std::__detail::_List_node_base::_M_unhook() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    (gdb) where
    [#0](/bitcoin-bitcoin/0/)  0x00007ffff664aef7 in std::__detail::_List_node_base::_M_unhook() () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    [#1](/bitcoin-bitcoin/1/)  0x000055555600f027 in std::__cxx11::list<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)>, std::allocator<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)> > >::_M_erase(std::_List_iterator<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)> >)Python Exception <class 'RuntimeError'> syntax error:
     (this=0x7fff84003658, __position=...) at /usr/include/c++/10/bits/stl_list.h:1922
    [#2](/bitcoin-bitcoin/2/)  0x0000555556003873 in std::__cxx11::list<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)>, std::allocator<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)> > >::erase(std::_List_const_iterator<std::function<void (std::unique_ptr<interfaces::Wallet, std::default_delete<interfaces::Wallet> >)> >)Python Exception <class 'RuntimeError'> syntax error:
     (this=0x7fff84003658, __position=...) at /usr/include/c++/10/bits/list.tcc:158
    [#3](/bitcoin-bitcoin/3/)  0x0000555555fd6bcb in operator()() const (__closure=0x7fff84004a48) at wallet/wallet.cpp:173
    [#4](/bitcoin-bitcoin/4/)  0x0000555555ffbf62 in std::__invoke_impl<void, wallet::HandleLoadWallet(wallet::WalletContext&, wallet::LoadWalletFn)::<lambda()>&>(std::__invoke_other, struct {...} &) (__f=...) at /usr/include/c++/10/bits/invoke.h:60
    [#5](/bitcoin-bitcoin/5/)  0x0000555555ffb578 in std::__invoke_r<void, wallet::HandleLoadWallet(wallet::WalletContext&, wallet::LoadWalletFn)::<lambda()>&>(struct {...} &) (__fn=...) at /usr/include/c++/10/bits/invoke.h:110
    [#6](/bitcoin-bitcoin/6/)  0x0000555555ffa9b1 in std::_Function_handler<void(), wallet::HandleLoadWallet(wallet::WalletContext&, wallet::LoadWalletFn)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/10/bits/std_function.h:291
    [#7](/bitcoin-bitcoin/7/)  0x000055555568eaf1 in std::function<void ()>::operator()() const (this=0x7fff84004a48) at /usr/include/c++/10/bits/std_function.h:622
    [#8](/bitcoin-bitcoin/8/)  0x0000555555df4930 in interfaces::(anonymous namespace)::CleanupHandler::~CleanupHandler() (this=0x7fff84004a40, __in_chrg=<optimized out>) at interfaces/handler.cpp:28
    [#9](/bitcoin-bitcoin/9/)  0x0000555555df49c3 in interfaces::(anonymous namespace)::CleanupHandler::~CleanupHandler() (this=0x7fff84004a40, __in_chrg=<optimized out>) at interfaces/handler.cpp:28
    [#10](/bitcoin-bitcoin/10/) 0x0000555555600b37 in std::default_delete<interfaces::Handler>::operator()(interfaces::Handler*) const (this=0x55555703cfe8, __ptr=0x7fff84004a40) at /usr/include/c++/10/bits/unique_ptr.h:85
    [#11](/bitcoin-bitcoin/11/) 0x00005555555fcddb in std::unique_ptr<interfaces::Handler, std::default_delete<interfaces::Handler> >::~unique_ptr() (this=0x55555703cfe8, __in_chrg=<optimized out>) at /usr/include/c++/10/bits/unique_ptr.h:361
    [#12](/bitcoin-bitcoin/12/) 0x00005555556a5d0c in SplashScreen::~SplashScreen() (this=0x55555703cf50, __in_chrg=<optimized out>) at qt/splashscreen.cpp:135
    [#13](/bitcoin-bitcoin/13/) 0x00005555556a5dbb in SplashScreen::~SplashScreen() (this=0x55555703cf50, __in_chrg=<optimized out>) at qt/splashscreen.cpp:138
    [#14](/bitcoin-bitcoin/14/) 0x00007ffff7ba8daf in QObject::event(QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#15](/bitcoin-bitcoin/15/) 0x00007ffff73a815f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
    [#16](/bitcoin-bitcoin/16/) 0x00007ffff7b7cfca in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#17](/bitcoin-bitcoin/17/) 0x00007ffff7b7fa01 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#18](/bitcoin-bitcoin/18/) 0x00007ffff7bd4e93 in  () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#19](/bitcoin-bitcoin/19/) 0x00007ffff5a7ce6b in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    [#20](/bitcoin-bitcoin/20/) 0x00007ffff5a7d118 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    [#21](/bitcoin-bitcoin/21/) 0x00007ffff5a7d1cf in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
    [#22](/bitcoin-bitcoin/22/) 0x00007ffff7bd451f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#23](/bitcoin-bitcoin/23/) 0x00007ffff7b7b98b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#24](/bitcoin-bitcoin/24/) 0x00007ffff7b83c00 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
    [#25](/bitcoin-bitcoin/25/) 0x00005555555ce96f in GuiMain(int, char**) (argc=2, argv=0x7fffffffdc58) at qt/bitcoin.cpp:697
    [#26](/bitcoin-bitcoin/26/) 0x00005555555c6908 in main(int, char**) (argc=2, argv=0x7fffffffdc58) at qt/main.cpp:24
    (gdb) 
    
  11. dooglus commented at 5:06 pm on October 19, 2022: contributor
    Oh, and absolutely nothing at all is written to debug.log!
  12. maflcko commented at 5:07 pm on October 19, 2022: member
    Yeah, that looks like a crash in the GUI (separate from the issue reported here). Maybe try running headless (bitcoind) for debugging the issue for now
  13. dooglus commented at 5:09 pm on October 19, 2022: contributor
    I’m rebuilding without --enable-debug. I’ll show the listtransactions output once that’s done.
  14. dooglus commented at 5:18 pm on October 19, 2022: contributor

    Without --enable-debug the listtransactions command doesn’t detect an internal error, and outputs the following instead of the error:

    $ for i in {453..455}; do echo "--- $i ---"; bitcoin-cli listtransactions '*' 1 $i; done
    --- 453 ---
    [
      {
        "address": "bc1qnle0kjvz4wyju49m00krxztdqu5ygak00nft37",
        "category": "send",
        "amount": -1.26545600,
        "label": "",
        "vout": 0,
        "fee": -0.00006450,
        "confirmations": 253735,
        "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
        "blockheight": 505672,
        "blockindex": 857,
        "blocktime": 1516693344,
        "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
        "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
        "walletconflicts": [
        ],
        "time": 1516689935,
        "timereceived": 1516689935,
        "bip125-replaceable": "no",
        "abandoned": false
      }
    ]
    --- 454 ---
    [
      {
        "category": "send",
        "amount": 0.00000000,
        "vout": 1,
        "fee": -0.00006450,
        "confirmations": 253735,
        "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
        "blockheight": 505672,
        "blockindex": 857,
        "blocktime": 1516693344,
        "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
        "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
        "walletconflicts": [
        ],
        "time": 1516689935,
        "timereceived": 1516689935,
        "bip125-replaceable": "no",
        "abandoned": false
      }
    ]
    --- 455 ---
    [
      {
        "address": "bc1qnle0kjvz4wyju49m00krxztdqu5ygak00nft37",
        "parent_descs": [
        ],
        "category": "receive",
        "amount": 1.26545600,
        "label": "",
        "vout": 0,
        "confirmations": 253735,
        "blockhash": "00000000000000000025a92c80f5c259ca5d9d36d407906dbefbd8075c3ae77b",
        "blockheight": 505672,
        "blockindex": 857,
        "blocktime": 1516693344,
        "txid": "b6439e1c9eb3915b3cc89871d2c2479f3f1847f0c7bab252c3ebc503b8f6d344",
        "wtxid": "393cfba86cb0d3274850aa461dab433b5d62c1dce68dc10d43de969b8dec2359",
        "walletconflicts": [
        ],
        "time": 1516689935,
        "timereceived": 1516689935,
        "bip125-replaceable": "no"
      }
    ]
    
  15. maflcko commented at 5:22 pm on October 19, 2022: member

    datacarrier outputs do not have an address. So this can be fixed by making "address" optional. See

    https://github.com/bitcoin/bitcoin/blob/a97791d9fb977cf2a0d19268253238b0fee173f6/src/wallet/rpc/transactions.cpp#L450

  16. dooglus commented at 5:24 pm on October 19, 2022: contributor

    The GUI crash was caused by me forgetting to specify my usual -datadir= flag, resulting in:

    2022-10-19T17:21:33Z Binding RPC on address ::1 port 8332 failed.
    2022-10-19T17:21:33Z Binding RPC on address 127.0.0.1 port 8332 failed.
    2022-10-19T17:21:33Z Unable to bind any endpoint for RPC server
    2022-10-19T17:21:33Z Error: Unable to start HTTP server. See debug log for details.
    

    as it attempts to use ports that are already in use by another bitcoin-qt instance.

  17. maflcko commented at 5:25 pm on October 19, 2022: member
    Mind reporting the GUI crash separately from this RPC doc issue?
  18. maflcko renamed this:
    Internal bug detected running listtransactions on OP_RETURN output
    doc: Internal bug detected running listtransactions on OP_RETURN output
    on Oct 19, 2022
  19. dooglus commented at 5:31 pm on October 19, 2022: contributor
    The GUI crash is #26340.
  20. achow101 closed this on Oct 27, 2022

  21. bitcoin locked this on Oct 27, 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-09-29 04:12 UTC

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