# ThreadSanitizer suppressions
# ============================
#
# https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions

# race (TODO fix)
race:LoadWallet
race:WalletBatch::WriteHDChain
race:BerkeleyBatch
race:BerkeleyDatabase
race:DatabaseBatch
race:zmq::*
race:bitcoin-qt

# deadlock (TODO fix)
# To reproduce, see:
# https://github.com/bitcoin/bitcoin/issues/19303#issuecomment-1514926359
deadlock:Chainstate::ConnectTip

# Intentional deadlock in tests
deadlock:sync_tests::potential_deadlock_detected

# Wildcard for all gui tests, should be replaced with non-wildcard suppressions
race:src/qt/test/*
deadlock:src/qt/test/*

# External libraries
# https://github.com/bitcoin/bitcoin/pull/27658#issuecomment-1547639621
deadlock:libdb
race:libzmq

# Intermittent issues
# -------------------
#
# Suppressions that follow might only happen intermittently, thus they are not
# reproducible. Make sure to include a link to a full trace.

# https://github.com/bitcoin/bitcoin/issues/20618
race:CZMQAbstractPublishNotifier::SendZmqMessage

# https://github.com/bitcoin/bitcoin/pull/27498#issuecomment-1517410478
race:epoll_ctl

# https://github.com/bitcoin/bitcoin/issues/23366
race:std::__1::ios_base::*

# Gridcoin scraper subsystem — per-instance cs_manifest lock-order false positives
# -----------------------------------------------------------------------------
# CScraperManifest objects each carry their own per-instance recursive_mutex
# (cs_manifest). When the code legitimately iterates the manifest map and
# acquires each manifest's cs_manifest in turn (BinCScraperManifestsByScraper,
# ScraperCullAndBinCScraperManifests), TSan's lock-order graph records the
# acquisitions as edges between distinct mutex addresses that nonetheless
# semantically represent the SAME class of lock. Combined with the global
# cs_mapParts / cs_ConvergedScraperStatsCache, TSan constructs a 3-4 hop cycle
# in its graph that does not correspond to any concrete deadlock scenario:
# the per-instance cs_manifest in different cycle nodes are different objects,
# so no single thread is ever blocked waiting for a lock it (or a partner)
# could deadlock against.
#
# The canonical real-lock ordering between the global mutexes is defended
# in-source (scraper_net.cpp:701 holds LOCK2(cs_mapParts, manifest->cs_manifest)
# in canonical order; main.cpp:2527 + :2679 document cs_main scoping rules
# vs cs_mapManifest / cs_manifest). The cycle does not extend beyond the
# scraper subsystem (no cs_main / cs_wallet / cs_vNodes participation in
# any of the reported cycles).
#
# Validated on the cleanup-branch TSan binary's public-testnet run
# (gridcoinresearch-5.5.0.2-sanitizer-cleanup-tsan-d27dd6440); 7335 reports
# audited, all from this single class.
deadlock:CScraperManifest
deadlock:CSplitBlob
deadlock:BinCScraperManifestsByScraper
