diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-07-21 10:50:18 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-07-21 10:50:18 +0100 |
commit | 1843130ffcc97618634a014829c17bfc638c2e29 (patch) | |
tree | 5ffdb67c50d62308135ccf2785b0c8c229225064 /src/rabbit.erl | |
parent | 8a22eda4066cb49309e26e16d12609fbe839ca57 (diff) | |
download | rabbitmq-server-1843130ffcc97618634a014829c17bfc638c2e29.tar.gz |
Fix await_startup/1. Change its design from "figure out what apps we should be running and wait for them" to "wait for the boot marker to go away".bug26295
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r-- | src/rabbit.erl | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index a4c460ae..191f04a4 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -365,10 +365,11 @@ start_it(StartFun) -> stop() -> case whereis(rabbit_boot) of undefined -> ok; - _ -> await_startup() + _ -> await_startup(true) end, rabbit_log:info("Stopping RabbitMQ~n"), - stop_apps(app_shutdown_order()). + Apps = ?APPS ++ rabbit_plugins:active(), + stop_apps(app_utils:app_dependency_order(Apps, true)). stop_and_halt() -> try @@ -410,7 +411,20 @@ run_cleanup_steps(Apps) -> ok. await_startup() -> - app_utils:wait_for_applications(app_startup_order()). + await_startup(false). + +await_startup(HaveSeenRabbitBoot) -> + %% We don't take absence of rabbit_boot as evidence we've started, + %% since there's a small window before it is registered. + case whereis(rabbit_boot) of + undefined -> case HaveSeenRabbitBoot orelse is_running() of + true -> ok; + false -> timer:sleep(100), + await_startup(false) + end; + _ -> timer:sleep(100), + await_startup(true) + end. status() -> S1 = [{pid, list_to_integer(os:getpid())}, @@ -461,6 +475,9 @@ listeners() -> ip_address = IP, port = Port} <- Listeners, Node =:= node()]. +%% TODO this only determines if the rabbit application has started, +%% not if it is running, never mind plugins. It would be nice to have +%% more nuance here. is_running() -> is_running(node()). is_running(Node) -> rabbit_nodes:is_process_running(Node, rabbit). @@ -508,17 +525,6 @@ stop(_State) -> ok. %%--------------------------------------------------------------------------- -%% application life cycle - -app_startup_order() -> - ok = app_utils:load_applications(?APPS), - app_utils:app_dependency_order(?APPS, false). - -app_shutdown_order() -> - Apps = ?APPS ++ rabbit_plugins:active(), - app_utils:app_dependency_order(Apps, true). - -%%--------------------------------------------------------------------------- %% boot step logic run_boot_steps() -> |