-
Notifications
You must be signed in to change notification settings - Fork 3k
RFC: Signal Service for OS Signals #1315
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
RFC: Signal Service for OS Signals #1315
Conversation
* and some minor refactoring
A received SIGHUP signal to beam will generate a '{notify, sighup}' message
to the registered process 'erl_signal_server'. 'erl_signal_server' is a
gen_event process.
|
I don't think that it should be allowed to handle SIGILL. There is no way to predict the state of the run-time system after executing an illegal instruction. Attempting to handle may do more harm than good, and could make it harder to find the original problem. Not sure about SIGCHLD either. Couldn't handling it interfere with |
|
@bjorng I agree that Once again, I agree that |
a143b02 to
d8eede9
Compare
|
Changed module from There is a coupling here that needs to be reconsidered. If a signal is set to be handled it will always send notifications to |
|
For Erlang code it only makes sense to allow asynchronous signals to be handled. Synchronous ones corresponding to hardware traps (SIGILL, SIGBUS, SIGSEGV, SIGFPE) should be excluded. |
* move signal handler setup
* Remove SIGILL from signal whitelist
* Add specs * Change return signature to 'ok' instead of 'true'
d8eede9 to
a62ef9a
Compare
a62ef9a to
1409b6a
Compare
References: |
Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315
Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
send notification for erl_signal_server on sigterm sent from runit Runit sends sigterm to the erlang application. Erlang 19.3 onwards erlang can be notified of some of the os signals. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
Changes to SIGTERM handling in Erlang 19.x caused runit failures in Chef Server. This was originally fixed when we upgraded to Erlang 19 by passing a startup flag to the Erlang VM on bootup. But the startup flag was removed in Erlang 20, so another fix had to be employed. This change effectively reverts Erlang's SIGTERM handling to previous (pre-19) behavior. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
Changes to SIGTERM handling in Erlang 19.x caused runit failures in Chef Server. This was originally fixed when we upgraded to Erlang 19 by passing a startup flag to the Erlang VM on bootup. But the startup flag was removed in Erlang 20, so another fix had to be employed. This change effectively reverts Erlang's SIGTERM handling to previous (pre-19) behavior. REF: erlang/otp#1315 Signed-off-by: Lincoln Baker <lbaker@chef.io>
In todays Erlang runtime system OS signals cannot be handled by an Erlang developer. Some signals are used internally by
erts, for instanceSIGUSR1is used to generate crashdumps,SIGUSR2is used to halt threads in a crashdump,SIGQUITis used to halt Erlang immediately,SIGINTis used for a break-handler which is only intended to be used for debugging andSIGTERM(from 19.3) will halt Erlang via init:stop/0.With this PR a
gen_eventserver,erl_signal_server, is started to handle enabled signals from the operating system. A default handler is installed to mimic the previous behavior of above signals except forSIGINT. The break-handler still usesSIGINTinternally.Subscribable signals with this PR are:
SIGHUP,SIGILL,SIGABRT,SIGALRM,SIGTERM,SIGQUIT,SIGUSR1,SIGUSR2,SIGCHLD,SIGSTOP,SIGTSTP.Signals can be enabled with
erts_internal:set_signal(Signal, Option), whereSignalis any subscribable signal, i.e.sighuporsigusr1, andOptionis one ofhandle,ignoreordefault. By settinghandlefor a signal it means that a notification will be sent toerl_signal_serveronce that signal has been received from the OS.Names are up for debate of course. As is the usability of this feature.
SIGTERMandSIGHUPwas the initial driving force for this.