HomePhabricator

test: Add race:SendZmqMessage tsan suppression

Description

test: Add race:SendZmqMessage tsan suppression

Summary:
See https://build.bitcoinabc.org/viewLog.html?buildId=300891&guest=1 for a tsan race while running interface_zmq.py

 node0 stdout ==================
WARNING: ThreadSanitizer: data race (pid=10367)
  Read of size 8 at 0x7b2400030238 by thread T19:
    #0 memcpy <null> (bitcoind+0x2645a7)
    #1 <null> <null> (libzmq.so.5+0x76220)

  Previous write of size 8 at 0x7b2400030238 by thread T12:
    #0 malloc <null> (bitcoind+0x258ee4)
    #1 <null> <null> (libzmq.so.5+0x39578)
    #2 CZMQAbstractPublishNotifier::SendZmqMessage(char const*, void const*, unsigned long) /work/abc-ci-builds/build-tsan/../../src/zmq/zmqpublishnotifier.cpp:164:14 (bitcoind+0xa1e7a9)
    ...
0
  Location is heap block of size 140 at 0x7b2400030210 allocated by thread T12:
    #0 malloc <null> (bitcoind+0x258ee4)
    #1 <null> <null> (libzmq.so.5+0x39578)
    #2 CZMQAbstractPublishNotifier::SendZmqMessage(char const*, void const*, unsigned long) /work/abc-ci-builds/build-tsan/../../src/zmq/zmqpublishnotifier.cpp:164:14 (bitcoind+0xa1e7a9)
    ...

  Thread T19 'ZMQbg/1' (tid=10388, running) created by main thread at:
    #0 pthread_create <null> (bitcoind+0x25a7ab)
    #1 <null> <null> (libzmq.so.5+0x6e8b3)
    #2 CZMQNotificationInterface::Initialize() /work/abc-ci-builds/build-tsan/../../src/zmq/zmqnotificationinterface.cpp:86:23 (bitcoind+0xa199d4)
    #3 CZMQNotificationInterface::Create() /work/abc-ci-builds/build-tsan/../../src/zmq/zmqnotificationinterface.cpp:61:36 (bitcoind+0xa19328)
    #4 AppInitMain(Config&, RPCServer&, HTTPRPCRequestProcessor&, NodeContext&, interfaces::BlockAndHeaderTipInfo*) /work/abc-ci-builds/build-tsan/../../src/init.cpp:2482:36 (bitcoind+0x30d673)
    #5 AppInit(int, char**) /work/abc-ci-builds/build-tsan/../../src/bitcoind.cpp:181:16 (bitcoind+0x2eaa8e)
    #6 main /work/abc-ci-builds/build-tsan/../../src/bitcoind.cpp:208:13 (bitcoind+0x2eaa8e)

  Thread T12 'b-scheduler' (tid=10380, running) created by main thread at:
    #0 pthread_create <null> (bitcoind+0x25a7ab)
    #1 boost::thread::start_thread_noexcept() <null> (libboost_thread.so.1.67.0+0x1396a)
    #2 boost::thread::thread<std::_Bind<void (* (char const*, std::function<void ()>))(char const*, std::function<void ()>)>&>(std::_Bind<void (* (char const*, std::function<void ()>))(char const*, std::function<void ()>)>&) /usr/include/boost/thread/detail/thread.hpp:266:13 (bitcoind+0x330342)
    #3 boost::thread* boost::thread_group::create_thread<std::_Bind<void (* (char const*, std::function<void ()>))(char const*, std::function<void ()>)> >(std::_Bind<void (* (char const*, std::function<void ()>))(char const*, std::function<void ()>)>) /usr/include/boost/thread/detail/thread_group.hpp:79:60 (bitcoind+0x32039e)
    #4 AppInitMain(Config&, RPCServer&, HTTPRPCRequestProcessor&, NodeContext&, interfaces::BlockAndHeaderTipInfo*) /work/abc-ci-builds/build-tsan/../../src/init.cpp:2243:17 (bitcoind+0x309628)
    #5 AppInit(int, char**) /work/abc-ci-builds/build-tsan/../../src/bitcoind.cpp:181:16 (bitcoind+0x2eaa8e)
    #6 main /work/abc-ci-builds/build-tsan/../../src/bitcoind.cpp:208:13 (bitcoind+0x2eaa8e)

    #1 <null> <null> (libzmq.so.5+0x6e8b3)
    #2 CZMQNotificationInterface::Initialize() /work/abc-ci-builds/build-tsan/../../src/zmq/zmqnotificationinterface.cpp:86:23 (bitcoind+0xa199d4)
    #3 CZMQNotificationInterface::Create() /work/abc-ci-builds/build-tsan/../../src/zmq/zmqnotificationinterface.cpp:61:36 (bitcoind+0xa19328)
    #4 AppInitMain(Config&, RPCServer&, HTTPRPCRequestProcessor&, NodeContext&, interfaces::BlockAndHeaderTipInfo*) /work/abc-ci-builds/build-tsan/../../src/init.cpp:2482:36 (bitcoind+0x30d673)
    #5 AppInit(int, char**) /work/abc-ci-builds/build-tsan/../../src/bitcoind.cpp:181:16 (bitcoind+0x2eaa8e)

This is a backport of core#20748

Test Plan:
With TSAN:
for i in $(seq 100); do TSAN_OPTIONS=second_deadlock_stack=1: TSAN_OPTIONS=suppressions=/home/pierre/dev/bitcoin-abc/test/sanitizer_suppressions/tsan test/functional/test_runner.py interface_zmq; done

This failure is intermittent, but relatively easy to reproduce: I was able to get it with 10 repetitions of the test, prior to adding the suppression.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10315

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Dec 22 2020, 18:56
PiRKCommitted on Oct 13 2021, 15:41
PiRKPushed on Oct 13 2021, 15:41
Reviewer
Restricted Project
Differential Revision
D10315: test: Add race:SendZmqMessage tsan suppression
Parents
rABCc0200506cb91: zmq: enable tcp keepalive
Branches
Unknown
Tags
Unknown