diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2013-05-31 15:12:57 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2013-05-31 15:12:57 +0100 |
| commit | 17499fa2429c349c9bd2996e3d7b677f61fa5267 (patch) | |
| tree | 24b34a31a98b0f5381cc2a1dbd6258f4899e7770 /src | |
| parent | 146b306c87aa8aa2d090200cbe26690ade55f0cd (diff) | |
| parent | 77b9dc8f07935f5fe474a549f635f1b055f1d74c (diff) | |
| download | rabbitmq-server-git-17499fa2429c349c9bd2996e3d7b677f61fa5267.tar.gz | |
merge stable into default
Diffstat (limited to 'src')
| -rw-r--r-- | src/app_utils.erl | 2 | ||||
| -rw-r--r-- | src/rabbit.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_misc.erl | 13 | ||||
| -rw-r--r-- | src/rabbit_nodes.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_plugins.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_vm.erl | 2 |
6 files changed, 17 insertions, 6 deletions
diff --git a/src/app_utils.erl b/src/app_utils.erl index 8da436c016..b102ce7578 100644 --- a/src/app_utils.erl +++ b/src/app_utils.erl @@ -93,7 +93,7 @@ app_dependency_order(RootApps, StripUnreachable) -> %% Private API wait_for_application(Application) -> - case lists:keymember(Application, 1, application:which_applications()) of + case lists:keymember(Application, 1, rabbit_misc:which_applications()) of true -> ok; false -> timer:sleep(1000), wait_for_application(Application) diff --git a/src/rabbit.erl b/src/rabbit.erl index 37ed5ae0a7..450a7f32d0 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -393,7 +393,7 @@ await_startup() -> status() -> S1 = [{pid, list_to_integer(os:getpid())}, - {running_applications, catch application:which_applications()}, + {running_applications, rabbit_misc:which_applications()}, {os, os:type()}, {erlang_version, erlang:system_info(system_version)}, {memory, rabbit_vm:memory()}], diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index c36fb147c8..a1e95fd5ee 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -61,7 +61,7 @@ -export([multi_call/2]). -export([os_cmd/1]). -export([gb_sets_difference/2]). --export([version/0]). +-export([version/0, which_applications/0]). -export([sequence_error/1]). -export([json_encode/1, json_decode/1, json_to_term/1, term_to_json/1]). -export([check_expiry/1]). @@ -232,6 +232,7 @@ -spec(os_cmd/1 :: (string()) -> string()). -spec(gb_sets_difference/2 :: (gb_set(), gb_set()) -> gb_set()). -spec(version/0 :: () -> string()). +-spec(which_applications/0 :: () -> [{atom(), string(), string()}]). -spec(sequence_error/1 :: ([({'error', any()} | any())]) -> {'error', any()} | any()). -spec(json_encode/1 :: (any()) -> {'ok', string()} | {'error', any()}). @@ -985,6 +986,16 @@ version() -> {ok, VSN} = application:get_key(rabbit, vsn), VSN. +%% application:which_applications(infinity) is dangerous, since it can +%% cause deadlocks on shutdown. So we have to use a timeout variant, +%% but w/o creating spurious timeout errors. +which_applications() -> + try + application:which_applications() + catch + exit:{timeout, _} -> [] + end. + sequence_error([T]) -> T; sequence_error([{error, _} = Error | _]) -> Error; sequence_error([_ | Rest]) -> sequence_error(Rest). diff --git a/src/rabbit_nodes.erl b/src/rabbit_nodes.erl index b52d36e3f0..b85646d211 100644 --- a/src/rabbit_nodes.erl +++ b/src/rabbit_nodes.erl @@ -96,7 +96,7 @@ cookie_hash() -> base64:encode_to_string(erlang:md5(atom_to_list(erlang:get_cookie()))). is_running(Node, Application) -> - case rpc:call(Node, application, which_applications, []) of + case rpc:call(Node, rabbit_misc, which_applications, []) of {badrpc, _} -> false; Apps -> proplists:is_defined(Application, Apps) end. diff --git a/src/rabbit_plugins.erl b/src/rabbit_plugins.erl index 58c906eb0a..6f6515b0e7 100644 --- a/src/rabbit_plugins.erl +++ b/src/rabbit_plugins.erl @@ -47,7 +47,7 @@ setup() -> active() -> {ok, ExpandDir} = application:get_env(rabbit, plugins_expand_dir), InstalledPlugins = [ P#plugin.name || P <- list(ExpandDir) ], - [App || {App, _, _} <- application:which_applications(), + [App || {App, _, _} <- rabbit_misc:which_applications(), lists:member(App, InstalledPlugins)]. %% @doc Get the list of plugins which are ready to be enabled. diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index c28b0cd578..e97824b9ad 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -99,7 +99,7 @@ bytes(Words) -> Words * erlang:system_info(wordsize). plugin_sups() -> lists:append([plugin_sup(App) || - {App, _, _} <- application:which_applications(), + {App, _, _} <- rabbit_misc:which_applications(), is_plugin(atom_to_list(App))]). plugin_sup(App) -> |
