From 509759e917f4c152f12e50a6b42488c7a51bf0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 27 Mar 2024 09:12:15 +0100 Subject: [PATCH] Revert dist blocker The dist_blocker feature was introduced to protect disconnected nodes from reconnecting before other nodes finished their clenaup. However, when dist_blocker kicks in, multiple unexpected error messages would appear on several nodes. This means that the solution cannot be accepted. --- src/ejabberd_sup.erl | 4 +--- src/mongoose_cleaner.erl | 2 -- test/mongoose_cleanup_SUITE.erl | 8 ++------ 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/ejabberd_sup.erl b/src/ejabberd_sup.erl index 80d45ce408..d2e723d792 100644 --- a/src/ejabberd_sup.erl +++ b/src/ejabberd_sup.erl @@ -38,7 +38,6 @@ start_link() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []). init([]) -> - DistBlocker = worker_spec(cets_dist_blocker), Hooks = worker_spec(gen_hook), Cleaner = worker_spec(mongoose_cleaner), Router = worker_spec(ejabberd_router), @@ -65,8 +64,7 @@ init([]) -> IQSupervisor = ejabberd_tmp_sup_spec(ejabberd_iq_sup, [ejabberd_iq_sup, mongoose_iq_worker]), {ok, {{one_for_one, 10, 1}, - [DistBlocker, - StartIdServer, + [StartIdServer, PG, Hooks, Cleaner, diff --git a/src/mongoose_cleaner.erl b/src/mongoose_cleaner.erl index 86dadfec93..5dfe0d594a 100644 --- a/src/mongoose_cleaner.erl +++ b/src/mongoose_cleaner.erl @@ -34,7 +34,6 @@ start_link() -> %%%=================================================================== init([]) -> - cets_dist_blocker:add_cleaner(self()), case net_kernel:monitor_nodes(true) of ok -> {ok, #state{}}; @@ -57,7 +56,6 @@ handle_info({nodedown, Node}, State) -> text => <<"mongoose_cleaner received nodenown event">>, down_node => Node}), cleanup_modules(Node), - cets_dist_blocker:cleaning_done(self(), Node), {noreply, State}; handle_info(_Info, State) -> {noreply, State}. diff --git a/test/mongoose_cleanup_SUITE.erl b/test/mongoose_cleanup_SUITE.erl index f16fbbaa40..f250b29cfc 100644 --- a/test/mongoose_cleanup_SUITE.erl +++ b/test/mongoose_cleanup_SUITE.erl @@ -97,7 +97,7 @@ opts() -> {modules, ?HOST} => #{}}. meck_mods() -> - [exometer, mod_bosh_socket, cets_dist_blocker, mongoose_bin, ejabberd_sm, ejabberd_local]. + [exometer, mod_bosh_socket, mongoose_bin, ejabberd_sm, ejabberd_local]. required_modules(muc, Config) -> required_module(mod_muc, #{online_backend => ?config(backend, Config), backend => mnesia}); @@ -291,11 +291,7 @@ setup_meck(mongoose_bin) -> meck:expect(mongoose_bin, gen_from_crypto, fun() -> <<"123456">> end); setup_meck(mod_bosh_socket) -> meck:new(mod_bosh_socket, [passthrough, no_link]), - meck:expect(mod_bosh_socket, start_supervisor, fun() -> {ok, self()} end); -setup_meck(cets_dist_blocker) -> - meck:new(cets_dist_blocker, [passthrough, no_link]), - meck:expect(cets_dist_blocker, add_cleaner, fun(_Pid) -> ok end), - meck:expect(cets_dist_blocker, cleaning_done, fun(_Pid, _Node) -> ok end). + meck:expect(mod_bosh_socket, start_supervisor, fun() -> {ok, self()} end). unload_meck(Module) -> meck:validate(Module),