summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2017-10-30 19:47:53 +0300
committerMichael Klishin <michael@clojurewerkz.org>2017-10-30 19:47:53 +0300
commit533d2df5dd1fbce2eb2a32799f78b785e476bd08 (patch)
treed802c60cfc6b31a595486f904e18aed5c1a16436 /src
parentb822e85b94278282ed014cfc61afc836df132108 (diff)
downloadrabbitmq-server-git-533d2df5dd1fbce2eb2a32799f78b785e476bd08.tar.gz
Make rabbit_networking:close_connection/2 more benign
The function relies on a fanout to all running cluster nodes which in turn check their local connection process group. All errors that might arise are ignored. There are at least two scenarios where the current behavior makes little sense: * A connection process has just terminated (but is still present in the stats DB) * A node could not respond (or respond in time) to the fanout In both cases claiming that connection pid is "not a connection pid" is misleading and likely will leave the user puzzled. This change makes connection_close/2 more benign: it simply logs a warning and returns instead of throwing. There are only two call sites that use it: rabbitmqctl and an HTTP API handler, so the chances of non-connection pids passed in are pretty slim. Per discussion with @gerhard.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_networking.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/rabbit_networking.erl b/src/rabbit_networking.erl
index 8b201fd87e..d64b8500b9 100644
--- a/src/rabbit_networking.erl
+++ b/src/rabbit_networking.erl
@@ -305,10 +305,16 @@ connection_info_all(Items, Ref, AggregatorPid) ->
connections()).
close_connection(Pid, Explanation) ->
- rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
case lists:member(Pid, connections()) of
- true -> rabbit_reader:shutdown(Pid, Explanation);
- false -> throw({error, {not_a_connection_pid, Pid}})
+ true ->
+ Res = rabbit_reader:shutdown(Pid, Explanation),
+ rabbit_log:info("Closing connection ~p because ~p~n", [Pid, Explanation]),
+ Res;
+ false ->
+ rabbit_log:warning("Asked to close connection ~p (reason: ~p) "
+ "but no running cluster node reported it as an active connection. Was it already closed? ~n",
+ [Pid, Explanation]),
+ ok
end.
force_connection_event_refresh(Ref) ->