Even if there was an exception during plugin_startup().
Currently, because a plugin is stored in the running_plugins list only after plugin_startup(), it would not be present if it throws during plugin_startup(), and as a consequence plugin_shutdown() would not be called on this plugin.
We need to make sure that plugin_shutdown() is called regardless of whether plugin_startup() completed successfully or not. That way, plugins can rest assured that whatever thread_pool or timer they started during plugin_startup() will be cleaned up, and no lambda referencing the plugin will be executed after the plugin is destroyed by the framework.
Even if there was an exception during
plugin_startup()
.Currently, because a plugin is stored in the
running_plugins
list only afterplugin_startup()
, it would not be present if it throws duringplugin_startup()
, and as a consequenceplugin_shutdown()
would not be called on this plugin.We need to make sure that
plugin_shutdown()
is called regardless of whetherplugin_startup()
completed successfully or not. That way, plugins can rest assured that whatever thread_pool or timer they started duringplugin_startup()
will be cleaned up, and no lambda referencing the plugin will be executed after the plugin is destroyed by the framework.see parent issue https://github.com/AntelopeIO/spring/issues/842.