tracing: test interface_usdt_net.py fails due to garbage message type in net:outbound_message tracepoint #33246

issue theStack openend this issue on August 23, 2025
  1. theStack commented at 11:25 am on August 23, 2025: contributor

    The functional test interface_usdt_net.py currently fails on master (commit 73220fc0f958f9b65f66cf0cf042af220b312fc6) on my aarch64 machine, running Ubuntu 25.04:

     0$ cmake -B build -DWITH_USDT=ON
     1$ cmake --build build -j12
     2# ./build/test/functional/interface_usdt_net.py
     32025-08-23T10:53:12.137229Z TestFramework (INFO): PRNG seed is: 2587673157417500984
     42025-08-23T10:53:12.137976Z TestFramework (INFO): Initializing test directory /tmp/bitcoin_func_test_iem787yt
     52025-08-23T10:53:12.415409Z TestFramework (INFO): hook into the net:inbound_message and net:outbound_message tracepoints
     62025-08-23T10:53:13.229315Z TestFramework (INFO): connect a P2P test node to our bitcoind node
     72025-08-23T10:53:13.336504Z TestFramework (INFO): check receipt and content of in- and outbound version messages
     82025-08-23T10:53:13.336668Z TestFramework (INFO): check_p2p_message(): inbound P2PMessage(peer=0, addr=127.0.0.1:54608, conn_type=inbound, msg_type=version, msg_size=111)
     92025-08-23T10:53:13.341459Z TestFramework (ERROR): Unexpected exception
    10Traceback (most recent call last):
    11  File "/home/thestack/bitcoin/test/functional/test_framework/test_framework.py", line 195, in main
    12    self.run_test()
    13    ~~~~~~~~~~~~~^^
    14  File "/home/thestack/bitcoin/./build/test/functional/interface_usdt_net.py", line 260, in run_test
    15    self.p2p_message_tracepoint_test()
    16    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
    17  File "/home/thestack/bitcoin/./build/test/functional/interface_usdt_net.py", line 334, in p2p_message_tracepoint_test
    18    check_p2p_message(event, is_inbound)
    19    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
    20  File "/home/thestack/bitcoin/./build/test/functional/interface_usdt_net.py", line 300, in check_p2p_message
    21    if event.msg_type.decode("utf-8") == "version":
    22       ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
    23UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 0: invalid start byte
    24.....
    

    The message type parameter in the net:outbound_message tracepoint seems to point to garbage at the time it is evaluated in the probe, as printing out the event.msg_type contents over a few test runs shows:

    0event.msg_type == b'\xa8\xc2\xffG\xff\xff'
    1event.msg_type == b'\xa8\xb2\xfbt\xff\xff'
    2event.msg_type == b'\xa8\xb2|i\xff\xff'
    3event.msg_type == b'\xa8\xc2\xffo\xff\xff'
    4event.msg_type == b'\xa8\xc2~S\xff\xff'
    5.....
    

    It looks like a potential life-time issue, but it’s unclear to me how this could be possible at all (see also e.g. #27380 (comment)), given that probes should be executed synchronously and the relevant msgtype object is clearly still alive after the tracepoint call (msg gets std::moved later in the function though): https://github.com/bitcoin/bitcoin/blob/73220fc0f958f9b65f66cf0cf042af220b312fc6/src/net.cpp#L3885

    OS / compiler / packages:

    0$ head -1 /etc/issue
    1Ubuntu 25.04 \n \l
    2$ uname -s -r -v -m
    3Linux 6.16.0-21-qcom-x1e [#21](/bitcoin-bitcoin/21/)-Ubuntu SMP PREEMPT_DYNAMIC Sun Aug 10 00:54:48 UTC 2025 aarch64
    4$ gcc --version | head -1
    5gcc (Ubuntu 14.2.0-19ubuntu2) 14.2.0
    6$ apt info systemtap-sdt-dev | grep Version
    7Version: 5.1-4.1
    
  2. achow101 commented at 11:28 pm on August 26, 2025: member
    I’m able to reproduce this with a release build, but not a debug build.
  3. maflcko commented at 10:27 am on August 27, 2025: member
    I can reproduce via -DAPPEND_CXXFLAGS='-O1 -g2', but it passes via -DAPPEND_CXXFLAGS='-O1 -fno-inline -g2', so I wonder if this is a compiler error, or if the error is something else.

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: 2025-09-02 12:13 UTC

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