Skip to content

Commit

Permalink
Shutdown thread pool in controller destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Feb 2, 2024
1 parent 4f6460e commit 7c7da93
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,6 @@ struct controller_impl {
}

~controller_impl() {
thread_pool.stop();
pending.reset();
//only log this not just if configured to, but also if initialization made it to the point we'd log the startup too
if(okay_to_print_integrity_hash_on_stop && conf.integrity_hash_on_stop)
Expand Down Expand Up @@ -3873,12 +3872,12 @@ controller::controller( const config& cfg, protocol_feature_set&& pfs, const cha

controller::~controller() {
my->abort_block();
/* Shouldn't be needed anymore.
//close fork_db here, because it can generate "irreversible" signal to this controller,
//in case if read-mode == IRREVERSIBLE, we will apply latest irreversible block
//for that we need 'my' to be valid pointer pointing to valid controller_impl.
my->fork_db.close();
*/
// controller_impl (my) holds a reference to controller (controller_impl.self)
// The self is mainly used to access signals defined on controller. Currently
// nothing posted to the thread_pool accesses the `self` reference, but to make
// sure it is safe in case something is added to the thread pool that does access self,
// stop the thread pool before the unique_ptr (my) destructor runs.
my->thread_pool.stop();
}

void controller::add_indices() {
Expand Down

0 comments on commit 7c7da93

Please sign in to comment.