summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuke Bakken <lbakken@pivotal.io>2019-01-09 10:55:55 -0800
committerLuke Bakken <lbakken@pivotal.io>2019-01-09 10:55:55 -0800
commite300a0c8b417c09849453f0a7beab846843568b8 (patch)
tree21fbf545d19355294cb6769d96bc32b61afedc84 /src
parent4876e9346d7cb82da594b7831c0ef8bd194a03cf (diff)
downloadrabbitmq-server-git-e300a0c8b417c09849453f0a7beab846843568b8.tar.gz
Update to sysmon_handler 1.1.0
Also ensure that sane defaults are used for sysmon_handler if not set by the user
Diffstat (limited to 'src')
-rw-r--r--src/rabbit.erl26
-rw-r--r--src/rabbit_sysmon_handler.erl5
2 files changed, 30 insertions, 1 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 2a37d0ba75..980b629a19 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -523,6 +523,7 @@ start_apps(Apps) ->
start_apps(Apps, RestartTypes) ->
app_utils:load_applications(Apps),
+ ensure_sysmon_handler_app_config(),
ConfigEntryDecoder = case application:get_env(rabbit, config_entry_decoder) of
undefined ->
[];
@@ -553,7 +554,6 @@ start_apps(Apps, RestartTypes) ->
PassPhrase
},
decrypt_config(Apps, Algo),
-
OrderedApps = app_utils:app_dependency_order(Apps, false),
case lists:member(rabbit, Apps) of
false -> rabbit_boot_steps:run_boot_steps(Apps); %% plugin activation
@@ -563,6 +563,30 @@ start_apps(Apps, RestartTypes) ->
handle_app_error(could_not_start),
RestartTypes).
+%% rabbitmq/rabbitmq-server#952
+%% This function is to be called after configuration has been optionally generated
+%% and the sysmon_handler application loaded, but not started. It will ensure that
+%% sane defaults are used for configuration settings that haven't been set by the
+%% user
+ensure_sysmon_handler_app_config() ->
+ Defaults = [
+ {process_limit, 100},
+ {port_limit, 100},
+ {gc_ms_limit, 0},
+ {schedule_ms_limit, 0},
+ {heap_word_limit, 10485760},
+ {busy_port, false},
+ {busy_dist_port, true}
+ ],
+ lists:foreach(fun({K, V}) ->
+ case application:get_env(sysmon_handler, K) of
+ undefined ->
+ application:set_env(sysmon_handler, K, V);
+ _ ->
+ ok
+ end
+ end, Defaults).
+
%% This function retrieves the correct IoDevice for requesting
%% input. The problem with using the default IoDevice is that
%% the Erlang shell prevents us from getting the input.
diff --git a/src/rabbit_sysmon_handler.erl b/src/rabbit_sysmon_handler.erl
index 4e878f618d..17625faeca 100644
--- a/src/rabbit_sysmon_handler.erl
+++ b/src/rabbit_sysmon_handler.erl
@@ -91,6 +91,11 @@ handle_event({monitor, PidOrPort, Type, Info}, State=#state{timer_ref=TimerRef})
{Fmt, Args} = format_pretty_proc_or_port_info(PidOrPort),
rabbit_log:warning("~p ~w ~w " ++ Fmt ++ " ~w", [?MODULE, Type, PidOrPort] ++ Args ++ [Info]),
{ok, State#state{timer_ref=NewTimerRef}};
+handle_event({suppressed, Type, Info}, State=#state{timer_ref=TimerRef}) ->
+ %% Reset the inactivity timeout
+ NewTimerRef = reset_timer(TimerRef),
+ rabbit_log:debug("~p ~w ~w", [?MODULE, Type, Info]),
+ {ok, State#state{timer_ref=NewTimerRef}};
handle_event(Event, State=#state{timer_ref=TimerRef}) ->
NewTimerRef = reset_timer(TimerRef),
rabbit_log:warning("~p unhandled event: ~p", [?MODULE, Event]),