-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle signals during plugin_initialize #39
Conversation
I'm wondering, in |
Yes, the signal handling is now in affect from |
application_base.cpp
Outdated
@@ -386,6 +373,9 @@ bool application_base::initialize_impl(int argc, char** argv, vector<abstract_pl | |||
std::string plugin_name; | |||
auto error_header = [&]() { return std::string("appbase: exception thrown during plugin \"") + plugin_name + "\" initialization.\n"; }; | |||
|
|||
// setup handling of SIGINT/SIGTERM/SIGPIPE/SIGHUP during initialize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this comment should have SIGHUP
removed because setup_signal_handling_on_ioc()
doesn't handle SIGHUP
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I actually updated the comment that was removed.
I don't think you can ^C out of loading a snapshot because I don't believe snapshot loading code polls EDIT: well technically not queued up since it was already delivered to the async_wait thread |
Related: AntelopeIO/spring#798 (comment) |
5b61671
to
bbd74cc
Compare
Spring creates the
controller
inchain_plugin::plugin_initialize
. If ctrl-c is pressed duringchain_plugin::plugin_initialize
chainbase
can be left with a dirty-db flag.appbase::initialize
so that it is in affect duringplugin_initialize
.signal_set
to removeSIGHUP
from the signal set. This was technically not thread-safe before. The boost docs indicate shared objects are not thread-safe. Since we discussed before that there was no real reason to treatSIGHUP
differently during startup, I just removed the cancel/restart. This makes it thread-safe and simplifies the implementation.