25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Stop ejabberd_system_monitor before stopping node

Sometimes monitor module is performing checks when node is stopping and
this causes crash in monitoring process.
This commit is contained in:
Paweł Chmielowski 2023-02-08 19:53:19 +01:00
parent 54cf37e917
commit d91812730b
2 changed files with 8 additions and 2 deletions

View File

@ -103,6 +103,7 @@ prep_stop(State) ->
ejabberd_sm:stop(),
ejabberd_service:stop(),
ejabberd_s2s:stop(),
ejabberd_system_monitor:stop(),
gen_mod:stop(),
State.

View File

@ -30,7 +30,7 @@
-author('ekhramtsov@process-one.net').
%% API
-export([start/0, config_reloaded/0]).
-export([start/0, config_reloaded/0, stop/0]).
%% gen_event callbacks
-export([init/1, handle_event/2, handle_call/2,
@ -68,6 +68,10 @@ start() ->
ejabberd:start_app(os_mon),
set_oom_watermark().
-spec stop() -> term().
stop() ->
gen_event:delete_handler(alarm_handler, ?MODULE, []).
excluded_apps() ->
[os_mon, mnesia, sasl, stdlib, kernel].
@ -115,7 +119,8 @@ handle_info(Info, State) ->
?WARNING_MSG("unexpected info: ~p~n", [Info]),
{ok, State}.
terminate(_Reason, _State) ->
terminate(_Reason, State) ->
misc:cancel_timer(State#state.tref),
ejabberd_hooks:delete(config_reloaded, ?MODULE, config_reloaded, 50).
code_change(_OldVsn, State, _Extra) ->