diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2013-02-14 12:24:53 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2013-02-14 12:24:53 +0000 |
commit | ae3922b6d9c69c508d984c14cdaec2b1730c5f4e (patch) | |
tree | b92c4c7c0710871b3734abd0117da4488e9a506a | |
parent | f5dc2b4f9860bacc5cde307c405f7e5f3fc66f53 (diff) | |
download | rabbitmq-server-ae3922b6d9c69c508d984c14cdaec2b1730c5f4e.tar.gz |
If we try to stop while starting, wait until we have stopped starting before stopping.
-rw-r--r-- | src/rabbit.erl | 8 |
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()). |