From fa79098ce2aca120d9039d583a5c5ea23b364b1b Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Wed, 4 Mar 2026 20:39:48 +0100 Subject: [PATCH] test: Fix shutdown vptr race in BlockFilterIndexSync bench --- src/bench/index_blockfilter.cpp | 3 +++ src/test/coinstatsindex_tests.cpp | 8 -------- src/test/txindex_tests.cpp | 8 -------- src/test/txospenderindex_tests.cpp | 1 + 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/bench/index_blockfilter.cpp b/src/bench/index_blockfilter.cpp index ea40b1320e1..805ad050bfc 100644 --- a/src/bench/index_blockfilter.cpp +++ b/src/bench/index_blockfilter.cpp @@ -53,6 +53,9 @@ static void BlockFilterIndexSync(benchmark::Bench& bench) IndexSummary summary = filter_index.GetSummary(); assert(summary.synced); assert(summary.best_block_hash == WITH_LOCK(::cs_main, return test_setup->m_node.chainman->ActiveTip()->GetBlockHash())); + + // Shutdown sequence (c.f. Shutdown() in init.cpp) + filter_index.Stop(); }); } diff --git a/src/test/coinstatsindex_tests.cpp b/src/test/coinstatsindex_tests.cpp index 74e5f4547c9..9b32aabbd25 100644 --- a/src/test/coinstatsindex_tests.cpp +++ b/src/test/coinstatsindex_tests.cpp @@ -64,14 +64,6 @@ BOOST_FIXTURE_TEST_CASE(coinstatsindex_initial_sync, TestChain100Setup) BOOST_CHECK(block_index != new_block_index); - // It is not safe to stop and destroy the index until it finishes handling - // the last BlockConnected notification. The BlockUntilSyncedToCurrentChain() - // call above is sufficient to ensure this, but the - // SyncWithValidationInterfaceQueue() call below is also needed to ensure - // TSAN always sees the test thread waiting for the notification thread, and - // avoid potential false positive reports. - m_node.validation_signals->SyncWithValidationInterfaceQueue(); - // Shutdown sequence (c.f. Shutdown() in init.cpp) coin_stats_index.Stop(); } diff --git a/src/test/txindex_tests.cpp b/src/test/txindex_tests.cpp index 82a60039709..35947996f6f 100644 --- a/src/test/txindex_tests.cpp +++ b/src/test/txindex_tests.cpp @@ -61,14 +61,6 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup) } } - // It is not safe to stop and destroy the index until it finishes handling - // the last BlockConnected notification. The BlockUntilSyncedToCurrentChain() - // call above is sufficient to ensure this, but the - // SyncWithValidationInterfaceQueue() call below is also needed to ensure - // TSAN always sees the test thread waiting for the notification thread, and - // avoid potential false positive reports. - m_node.validation_signals->SyncWithValidationInterfaceQueue(); - // shutdown sequence (c.f. Shutdown() in init.cpp) txindex.Stop(); } diff --git a/src/test/txospenderindex_tests.cpp b/src/test/txospenderindex_tests.cpp index f890692d42b..44d2bf0e5e7 100644 --- a/src/test/txospenderindex_tests.cpp +++ b/src/test/txospenderindex_tests.cpp @@ -70,6 +70,7 @@ BOOST_FIXTURE_TEST_CASE(txospenderindex_initial_sync, TestChain100Setup) BOOST_CHECK_EQUAL((*tx_spender)->block_hash, tip_hash); } + // Shutdown sequence (c.f. Shutdown() in init.cpp) txospenderindex.Stop(); }