diff options
author | Martin Zumsande <mzumsande@gmail.com> | 2024-07-12 01:05:16 -0400 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2024-07-17 11:27:03 +0100 |
commit | 05192ba84c2d0ef727c9dbc1e6af4ce8a59458fa (patch) | |
tree | fec1707a2a9dbc5412bf27ad6502f3ea17c8d1b5 | |
parent | ab422066527992d53c92bb482c6b993f089b2999 (diff) |
init: change shutdown order of load block thread and scheduler
This avoids situations during a reindex in which shutdown
doesn't finish since SyncWithValidationInterfaceQueue is
called by the load block thread when the scheduler is already stopped.
Github-Pull: #30435
Rebased-From: 5fd48360198d2ac49e43b24cc1469557b03567b8
-rw-r--r-- | src/init.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index 988daefeec..a569c3bd0d 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -296,10 +296,11 @@ void Shutdown(NodeContext& node) StopTorControl(); + if (node.chainman && node.chainman->m_thread_load.joinable()) node.chainman->m_thread_load.join(); // After everything has been shut down, but before things get flushed, stop the - // scheduler and load block thread. + // the scheduler. After this point, SyncWithValidationInterfaceQueue() should not be called anymore + // as this would prevent the shutdown from completing. if (node.scheduler) node.scheduler->stop(); - if (node.chainman && node.chainman->m_thread_load.joinable()) node.chainman->m_thread_load.join(); // After the threads that potentially access these pointers have been stopped, // destruct and reset all to nullptr. |