diff options
| author | Daniil Fedotov <dfedotov@pivotal.io> | 2017-04-10 17:20:20 +0100 |
|---|---|---|
| committer | Daniil Fedotov <dfedotov@pivotal.io> | 2017-04-10 17:20:20 +0100 |
| commit | 8dc4a182ee7cfbb2e560cbc3d93653fbdf240449 (patch) | |
| tree | 8c04a530a87f68f63198aff88cb6f2d6fe32ea0b /src | |
| parent | 4b69f48b772590af7b75699c60f7bef4fbeac4c8 (diff) | |
| parent | f0da42683f491b527cd3358c91c9370d8be3d5fd (diff) | |
| download | rabbitmq-server-git-8dc4a182ee7cfbb2e560cbc3d93653fbdf240449.tar.gz | |
Merge branch 'stable'
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit.erl | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 77be20ea17..680a6a2a98 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -481,16 +481,21 @@ stop_and_halt() -> rabbit_log:error("Error trying to stop RabbitMQ: ~p:~p", [Type, Reason]), error({Type, Reason}) after - AppsLeft = [ A || {A, _, _} <- application:which_applications() ], - rabbit_log:info( - lists:flatten(["Halting Erlang VM with the following applications:~n", - [" ~p~n" || _ <- AppsLeft]]), - AppsLeft), - %% Also duplicate this information to stderr, so console where - %% foreground broker was running (or systemd journal) will - %% contain information about graceful termination. - io:format(standard_error, "Gracefully halting Erlang VM~n", []), - init:stop() + %% Enclose all the logging in the try block. + %% init:stop() will be called regardless of any errors. + try + AppsLeft = [ A || {A, _, _} <- application:which_applications() ], + rabbit_log:info( + lists:flatten(["Halting Erlang VM with the following applications:~n", + [" ~p~n" || _ <- AppsLeft]]), + AppsLeft), + %% Also duplicate this information to stderr, so console where + %% foreground broker was running (or systemd journal) will + %% contain information about graceful termination. + io:format(standard_error, "Gracefully halting Erlang VM~n", []) + after + init:stop() + end end, ok. |
