Skip to content

Commit

Permalink
GH-3 Shutdown nodeos on vote thread pool exception
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Apr 11, 2024
1 parent fba5561 commit 1dcf7c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 4 additions & 1 deletion libraries/chain/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,10 @@ struct controller_impl {
if( shutdown ) shutdown();
} );
if (cfg.vote_thread_pool_size > 0) {
vote_processor.start(cfg.vote_thread_pool_size);
vote_processor.start(cfg.vote_thread_pool_size, [this]( const fc::exception& e ) {
elog( "Exception in vote thread pool, exiting: ${e}", ("e", e.to_detail_string()) );
if( shutdown ) shutdown();
} );
}

set_activation_handler<builtin_protocol_feature_t::preactivate_feature>();
Expand Down
6 changes: 2 additions & 4 deletions libraries/chain/include/eosio/chain/vote_processor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ class vote_processor_t {
cv.notify_one();
}

void start(size_t num_threads) {
void start(size_t num_threads, decltype(thread_pool)::on_except_t&& on_except) {
assert(num_threads > 1); // need at least two as one is used for coordinatation
thread_pool.start( num_threads, []( const fc::exception& e ) {
elog( "Exception in vote processor thread pool, exiting: ${e}", ("e", e.to_detail_string()) );
} );
thread_pool.start( num_threads, std::move(on_except));

// one coordinator thread
boost::asio::post(thread_pool.get_executor(), [&]() {
Expand Down

0 comments on commit 1dcf7c1

Please sign in to comment.