diff options
| author | Tim Watson <tim@rabbitmq.com> | 2012-10-17 13:57:55 +0100 |
|---|---|---|
| committer | Tim Watson <tim@rabbitmq.com> | 2012-10-17 13:57:55 +0100 |
| commit | 486b13c0f458051c848d79f2751740a6a486084a (patch) | |
| tree | ba01a14fc447ab00019f60bb368aaae6ed980bc8 /src/rabbit.erl | |
| parent | bbd45f3d83621c78df930ab03864de04f65daacf (diff) | |
| parent | 644a4f767b7d4ffcd2072ecb9447efe93484d725 (diff) | |
| download | rabbitmq-server-git-486b13c0f458051c848d79f2751740a6a486084a.tar.gz | |
merge default
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 93808f8413..5dcf27ed53 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -300,9 +300,11 @@ start() -> %% We do not want to HiPE compile or upgrade %% mnesia after just restarting the app ok = ensure_application_loaded(), - ok = rabbit_node_monitor:prepare_cluster_status_files(), - ok = rabbit_mnesia:check_cluster_consistency(), ok = ensure_working_log_handlers(), + apply_post_boot_step( + fun rabbit_node_monitor:prepare_cluster_status_files/0), + apply_post_boot_step( + fun rabbit_mnesia:check_cluster_consistency/0), ok = app_utils:start_applications( app_startup_order(), fun handle_app_error/2), ok = print_plugin_info(rabbit_plugins:active()) @@ -312,13 +314,15 @@ boot() -> start_it(fun() -> ok = ensure_application_loaded(), maybe_hipe_compile(), - ok = rabbit_node_monitor:prepare_cluster_status_files(), ok = ensure_working_log_handlers(), + apply_post_boot_step( + fun rabbit_node_monitor:prepare_cluster_status_files/0), ok = rabbit_upgrade:maybe_upgrade_mnesia(), %% It's important that the consistency check happens after %% the upgrade, since if we are a secondary node the %% primary node will have forgotten us - ok = rabbit_mnesia:check_cluster_consistency(), + apply_post_boot_step( + fun rabbit_mnesia:check_cluster_consistency/0), Plugins = rabbit_plugins:setup(), ToBeLoaded = Plugins ++ ?APPS, ok = app_utils:load_applications(ToBeLoaded), @@ -329,6 +333,13 @@ boot() -> ok = print_plugin_info(Plugins) end). +apply_post_boot_step(Step) -> + try + ok = Step() + catch + _:Reason -> boot_error(Reason, erlang:get_stacktrace()) + end. + handle_app_error(App, {bad_return, {_MFA, {'EXIT', {Reason, _}}}}) -> boot_error({could_not_start, App, Reason}, not_available); @@ -530,11 +541,13 @@ boot_error({error, {timeout_waiting_for_tables, _}}, _Stacktrace) -> Ns} end, basic_boot_error(Err ++ rabbit_nodes:diagnostics(Nodes) ++ "~n~n", []); - boot_error(Reason, Stacktrace) -> - Fmt = "Error description:~n ~p~n~n" + Fmt = "Error description:~n ~p~n~n" ++ "Log files (may contain more information):~n ~s~n ~s~n~n", Args = [Reason, log_location(kernel), log_location(sasl)], + boot_error(Fmt, Args, Stacktrace). + +boot_error(Fmt, Args, Stacktrace) -> case Stacktrace of not_available -> basic_boot_error(Fmt, Args); _ -> basic_boot_error(Fmt ++ "Stack trace:~n ~p~n~n", |
