From fcbf379af88b51314b418844e0a199d871470e8f Mon Sep 17 00:00:00 2001 From: furszy Date: Fri, 5 Feb 2021 20:06:33 -0300 Subject: [PATCH] BugFix: stop threadGroup before dump data to disk. Otherwise threads will continue modifying data structures while the dump process is being executed. --- src/init.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index bef8284eba5f..eb4a80e1abb8 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -242,6 +242,11 @@ void PrepareShutdown() StopTorControl(); + // After everything has been shut down, but before things get flushed, stop the + // CScheduler/checkqueue threadGroup + threadGroup.interrupt_all(); + threadGroup.join_all(); + DumpMasternodes(); DumpBudgets(g_budgetman); DumpMasternodePayments(); @@ -250,11 +255,6 @@ void PrepareShutdown() DumpMempool(); } - // After everything has been shut down, but before things get flushed, stop the - // CScheduler/checkqueue threadGroup - threadGroup.interrupt_all(); - threadGroup.join_all(); - if (fFeeEstimatesInitialized) { fs::path est_path = GetDataDir() / FEE_ESTIMATES_FILENAME; CAutoFile est_fileout(fsbridge::fopen(est_path, "wb"), SER_DISK, CLIENT_VERSION);