diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-10-13 12:41:42 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-10-13 18:19:39 +0200 |
| commit | 1ce9df26951db79a052d75651c84e5ffca397846 (patch) | |
| tree | 13edea99f7db7513c29e1417762fcd02829e3b6b | |
| parent | e555f5ca02f27a123638565335f928f017662396 (diff) | |
| download | rabbitmq-server-git-1ce9df26951db79a052d75651c84e5ffca397846.tar.gz | |
rabbit_channel_tracking: Don't update channel tracking directly when a connection is closed
Tracking is already taken care of when each channel is closed.
Removing this concurrent call to `unregister_tracked()` fixes a
double-decrease of the counter. The reason is the counter is updated
outside of a transaction and is therefore sensitive to concurrent
read/modify/write sequences.
A transaction would be a more appropriate solution, but it may be too
resources-intensive in the scenario of high connection/channel churn.
| -rw-r--r-- | src/rabbit_channel_tracking.erl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/rabbit_channel_tracking.erl b/src/rabbit_channel_tracking.erl index 52b84dc90b..42ab664a06 100644 --- a/src/rabbit_channel_tracking.erl +++ b/src/rabbit_channel_tracking.erl @@ -102,9 +102,9 @@ handle_cast({connection_closed, ConnDetails}) -> rabbit_log_connection:info( "Closing all channels from connection '~p' " "because it has been closed", [pget(name, ConnDetails)]), + %% Shutting down channels will take care of unregistering the + %% corresponding tracking. shutdown_tracked_items(TrackedChs, undefined), - [unregister_tracked(rabbit_tracking:id(ThisNode, Name)) || - #tracked_channel{name = Name} <- TrackedChs], ok; _DifferentNode -> ok |
