summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-02-14 12:24:53 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-02-14 12:24:53 +0000
commitae3922b6d9c69c508d984c14cdaec2b1730c5f4e (patch)
treeb92c4c7c0710871b3734abd0117da4488e9a506a
parentf5dc2b4f9860bacc5cde307c405f7e5f3fc66f53 (diff)
downloadrabbitmq-server-ae3922b6d9c69c508d984c14cdaec2b1730c5f4e.tar.gz
If we try to stop while starting, wait until we have stopped starting before stopping.
-rw-r--r--src/rabbit.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index fa8dc652..5f36f17d 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -342,6 +342,7 @@ handle_app_error(App, Reason) ->
throw({could_not_start, App, Reason}).
start_it(StartFun) ->
+ register(rabbit_boot, self()),
try
StartFun()
catch
@@ -350,11 +351,18 @@ start_it(StartFun) ->
_:Reason ->
boot_error(Reason, erlang:get_stacktrace())
after
+ %% In the boot/0 case the process exits - but in the start/0
+ %% case it is some random RPC server and does not.
+ unregister(rabbit_boot),
%% give the error loggers some time to catch up
timer:sleep(100)
end.
stop() ->
+ case whereis(rabbit_boot) of
+ undefined -> ok;
+ _ -> await_startup()
+ end,
rabbit_log:info("Stopping RabbitMQ~n"),
ok = app_utils:stop_applications(app_shutdown_order()).