[erlang-questions] beam.smp signal handling

Michał Ptaszek <>
Mon Mar 25 19:45:12 CET 2013


Thanks!
Will try out both approaches (stty/sighandler) and evaluate which one is
closer to what we need.


On Sat, Mar 23, 2013 at 1:12 AM, Andrew Tunnell-Jones <>wrote:

> Hi,
>
> I wrote a signal handler a little while back. With it you can do something
> like:
>
>   {ok,Ref} = sighandler:install(int,fun() -> io:fwrite("Interrupt
> disabled\n") end).
>
> And if you later want to restore interrupt:
>
>   sighandler:remove(Ref).
>
> Be aware:
>  * It uses a driver
>  * I've not (yet) updated it to suit the change in the driver API in R16
> from driver_output_term() to erl_drv_output_term() (it still works in R16,
> but won't in R17)
>  * I've not used it in any serious way (and have no immediate plans to)
>
> The code is available from <https://github.com/andrewtj/sighandler>.
>
> Regards,
> Andrew
>
> On Tuesday, March 19, 2013 10:09:52 AM UTC+11, Michał Ptaszek wrote:
>>
>> Hey,
>>
>> in order to avoid stupid mistakes on production we have disabled break
>> signal handling for the VM by adding +Bi switch to the options passed to
>> 'beam.smp' command. As a result, if anyone is connect to the shell via pipe
>> and hits CTRL+C - nothing should happen. In order to kill the node someone
>> must intentionally run init:stop()/q() from inside of the node.
>>
>> Unfortunately, as a result, we are not able to handle USR1 signals
>> anymore and thus not being able to generate crash dumps when the VM is
>> stuck. If +Bi option is passed VM is terminated with "User defined signal
>> 1" reason.
>>
>> Temporarily we can run the VM with +Bc switch however I was wondering if
>> there is any other way to completely disable SIGINT, but not SIGUSR1 signal
>> handlers?
>>
>> Thanks,
>> Michal
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130325/828c2cf1/attachment.html>


More information about the erlang-questions mailing list