From a3dae1f35e5fa3394f10e5b59c3df347bf15cf7f Mon Sep 17 00:00:00 2001 From: Michal Kuratczyk Date: Thu, 9 Jan 2025 14:31:26 +0100 Subject: [PATCH] Handle no available nodes to cluster with This came up when testing whether all nodes would wait for node 0 could not start. To test this, I was killing node 0 every few seconds, so it would attempt to start and then get killed. This led to other nodes sometimes discovering it and attempting to sync, but then crashing with function_clause as it went away. --- deps/rabbit/src/rabbit_peer_discovery.erl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/deps/rabbit/src/rabbit_peer_discovery.erl b/deps/rabbit/src/rabbit_peer_discovery.erl index 56400d3569e..0b196873c05 100644 --- a/deps/rabbit/src/rabbit_peer_discovery.erl +++ b/deps/rabbit/src/rabbit_peer_discovery.erl @@ -835,6 +835,12 @@ can_use_discovered_nodes(_DiscoveredNodes, []) -> %% %% @private +select_node_to_join([]) -> + ?LOG_INFO( + "Peer discovery: no nodes available for auto-clustering; waiting before retrying...", + [], + #{domain => ?RMQLOG_DOMAIN_PEER_DISC}), + false; select_node_to_join([{Node, _Members, _StartTime, _IsReady} | _]) when Node =:= node() -> ?LOG_INFO(