Skip to content

Commit 6513d02

Browse files
committed
Avoid crash when reporting federation status
This should address crashes like this in (found in user's logs): ``` exception error: no case clause matching [[{connection_details,[]}, {name,<<"10.0.13.41:50497 -> 10.2.230.128:5671 (1)">>}, {node,rabbit@foobar}, {number,1}, {user,<<"...">>}, {user_who_performed_action,<<"...">>}, {vhost,<<"/">>}], [{connection_details,[]}, {name,<<"10.0.13.41:50142 -> 10.2.230.128:5671 (1)">>}, {node,rabbit@foobar}, {number,1}, {user,<<"...">>}, {user_who_performed_action,<<"...">>}, {vhost,<<"/">>}]] in function rabbit_federation_mgmt:format/3 (rabbit_federation_mgmt.erl, line 100) in call from rabbit_federation_mgmt:'-status/3-lc$^0/1-0-'/4 (rabbit_federation_mgmt.erl, line 89) in call from rabbit_federation_mgmt:'-status/4-lc$^0/1-0-'/3 (rabbit_federation_mgmt.erl, line 82) in call from rabbit_federation_mgmt:'-status/4-lc$^0/1-0-'/3 (rabbit_federation_mgmt.erl, line 82) in call from rabbit_federation_mgmt:status/4 (rabbit_federation_mgmt.erl, line 82) in call from rabbit_federation_mgmt:to_json/2 (rabbit_federation_mgmt.erl, line 57) in call from cowboy_rest:call/3 (src/cowboy_rest.erl, line 1590) in call from cowboy_rest:set_resp_body/2 (src/cowboy_rest.erl, line 1473) ```
1 parent f10e084 commit 6513d02

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

deps/rabbitmq_federation_management/src/rabbit_federation_mgmt.erl

+6-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,12 @@ format(Node, Info, Chs) ->
101101
[Ch || Ch <- Chs,
102102
pget(name, pget(connection_details, Ch))
103103
=:= pget(local_connection, Info)]) of
104-
[Ch] -> [{local_channel, Ch}];
104+
[Ch|_] ->
105+
%% we iterate on responses from many nodes; if the link
106+
%% was restarted on another node, we might get duplicates;
107+
%% we don't really know which one is the most up-to-date
108+
%% so let's just take the first one
109+
[{local_channel, Ch}];
105110
[] -> []
106111
end,
107112
[{node, Node} | format_info(Info)] ++ LocalCh.

0 commit comments

Comments
 (0)