Skip to content

Commit 86e7410

Browse files
committed
Merge bitcoin/bitcoin#27348: test: fix intermittent failure in ChainStateManager tests
f8abcb3 test: Fix intermittent failure in ChainStateManager tests (Martin Zumsande) Pull request description: Before wiping a `ChainStateManager` and creating a new one, the `validationinterface` queue should be emptied to avoid the possibility of accessing deleted memory. This could lead to very rare CI failures reported in #26613 and #27320 (see [here](bitcoin/bitcoin#27320 (comment)) for a more detailed explanation). Fixes #27320 ACKs for top commit: jamesob: crACK bitcoin/bitcoin@f8abcb3 MarcoFalke: lgtm ACK f8abcb3 Tree-SHA512: 953fcca46ffee039ae1c8c98eed5464ba7ee0007f54e18989caab3f645f5f45e64407a21f614984fd2843a3d56219f44603086b0c305a9a5cec64a8bf76c110a
2 parents b759cef + f8abcb3 commit 86e7410

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/test/validation_chainstatemanager_tests.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,13 @@ struct SnapshotTestSetup : TestChain100Setup {
367367

368368
BOOST_TEST_MESSAGE("Simulating node restart");
369369
{
370-
LOCK(::cs_main);
371370
for (Chainstate* cs : chainman.GetAll()) {
371+
LOCK(::cs_main);
372372
cs->ForceFlushStateToDisk();
373373
}
374+
// Process all callbacks referring to the old manager before wiping it.
375+
SyncWithValidationInterfaceQueue();
376+
LOCK(::cs_main);
374377
chainman.ResetChainstates();
375378
BOOST_CHECK_EQUAL(chainman.GetAll().size(), 0);
376379
const ChainstateManager::Options chainman_opts{

0 commit comments

Comments
 (0)