Skip to content

Commit de5bc6e

Browse files
Merge pull request #1413 from rabbitmq/mk-dont-throw-when-connection-pid-is-non-local
Make rabbit_networking:close_connection/2 more benign
2 parents b822e85 + 533d2df commit de5bc6e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/rabbit_networking.erl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,16 @@ connection_info_all(Items, Ref, AggregatorPid) ->
305305
connections()).
306306

307307
close_connection(Pid, Explanation) ->
308-
rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
309308
case lists:member(Pid, connections()) of
310-
true -> rabbit_reader:shutdown(Pid, Explanation);
311-
false -> throw({error, {not_a_connection_pid, Pid}})
309+
true ->
310+
Res = rabbit_reader:shutdown(Pid, Explanation),
311+
rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
312+
Res;
313+
false ->
314+
rabbit_log:warning("Asked to close connection ~p (reason: ~p) "
315+
"but no running cluster node reported it as an active connection. Was it already closed? ~n",
316+
[Pid, Explanation]),
317+
ok
312318
end.
313319

314320
force_connection_event_refresh(Ref) ->

0 commit comments

Comments
 (0)