From e122844e64d6f2a3e275095ffbeeb4b7b1ac489d Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Mon, 16 Sep 2019 11:17:53 -0400 Subject: [PATCH] Make sure plugin_shutdown is called in case of exception in plugin_startup to ensure proper shutdown on exception --- plugins/producer_plugin/producer_plugin.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/producer_plugin/producer_plugin.cpp b/plugins/producer_plugin/producer_plugin.cpp index 4291dffaeb6..a9cfab68cb4 100644 --- a/plugins/producer_plugin/producer_plugin.cpp +++ b/plugins/producer_plugin/producer_plugin.cpp @@ -804,6 +804,7 @@ void producer_plugin::plugin_startup() { try { handle_sighup(); // Sets loggers + try { ilog("producer plugin: plugin_startup() begin"); chain::controller& chain = my->chain_plug->chain(); @@ -840,6 +841,11 @@ void producer_plugin::plugin_startup() my->schedule_production_loop(); ilog("producer plugin: plugin_startup() end"); + } catch( ... ) { + // always call plugin_shutdown, even on exception + plugin_shutdown(); + throw; + } } FC_CAPTURE_AND_RETHROW() } void producer_plugin::plugin_shutdown() {