diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-02-11 09:45:52 +0100 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-02-20 17:41:07 +0100 |
| commit | 02aa73c36b720ae713d182ede1b8fc59966fcb41 (patch) | |
| tree | 2fafa0f0e77f4a003885956bbd4e8ebe96e98e77 /src/rabbit.erl | |
| parent | 3aa744ff56946e291e898bb6482248da626ea3a2 (diff) | |
| download | rabbitmq-server-git-02aa73c36b720ae713d182ede1b8fc59966fcb41.tar.gz | |
Only handle SIGHUP and SIGTSTP
Here is a summary of RabbitMQ signal handling:
== SIGTERM ==
After #2180, `rabbit` is a regular Erlang application and
`application:stop(rabbit)` terminates RabbitMQ gracefully. This means
that `init:stop()` shuts the service down properly. Therefore, the
default handling of SIGTERM, which calls `init:stop()`, is correct.
rabbitmq-server(8) already relies on this mechanism.
This commit restores the default signal handler which already does the
right thing. No need to do it ourselves.
== SIGHUP and SIGTSTP ==
SIHGUP is usually used to reload the configuration without restarting
the service and/or reopen log files after log file rotation. SIGTSTP is
sent when a user types Ctrl+Z to pause a program and get back to the
shell. Both signals have common behavior we can't satisfy currently.
Note that we don't handle SIGCONT which is the one used to resume a
program after SIGTSTP. The system default behavior is already good (the
signal is discarded).
To be consistent with rabbitmq-server(8) signal handling, the signals
are ignored until we can do something about them.
== SIGQUIT ==
This signal is meant to terminate the process immediately and
create a core dump. If possible, temporary files should even be kept
around. The default behavior in Erlang is to call `erlang:halt()` which
is a sane default: we should not stop RabbitMQ gracefully.
This commit restores this behavior.
== SIGUSR1 and SIGUSR2 ==
Erlang uses SIGUSR1 to crash the VM and create an `erl_crash.dump`
file. We already used this in the past to debug RabbitMQ. Again, a sane
default.
This commit restores this behavior.
== Other signals ==
We keep the default behavior of all other signals. None of them are
meant to stop the program gracefully anyway. If a user wants to stop
RabbitMQ, he will already use the common accepted signal for this
purpose (i.e. SIGTERM).
Another change in this commit is the way we setup the signal handler:
* We don't replace the default Erlang signal handler, just add ours.
* We do it very early in rabbitmq_prelaunch. Like other things
configured by this application, we do not uninstall the handler when
the application is stopped.
This reverts:
* commit 6a4d2721d06b8c70a36e29e6c51bbef6608def55
* commit fa607e4a25d6142bb17a90b44ef757572a923c09
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 0f98e50504..12b12bb222 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -235,12 +235,6 @@ {requires, pre_flight} ]}). --rabbit_boot_step({os_signal_handler, - [{description, "registers an OS signal handler"}, - {mfa, {rabbit_sup, start_restartable_child, - [rabbit_os_signal_handler]}}, - {requires, pre_flight}]}). - -rabbit_boot_step({direct_client, [{description, "direct client"}, {mfa, {rabbit_direct, boot, []}}, |
