Skip to content

Fix memory leak when using mandatory flag in CQs #3560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions deps/rabbit/src/rabbit_classic_queue.erl
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ settlement_action(Type, QRef, MsgSeqs, Acc) ->
deliver(Qs0, #delivery{flow = Flow,
msg_seq_no = MsgNo,
message = #basic_message{exchange_name = _Ex},
confirm = _Confirm} = Delivery) ->
confirm = Confirm} = Delivery) ->
%% TODO: record master and slaves for confirm processing
{MPids, SPids, Qs, Actions} = qpids(Qs0, MsgNo),
{MPids, SPids, Qs, Actions} = qpids(Qs0, Confirm, MsgNo),
QPids = MPids ++ SPids,
case Flow of
%% Here we are tracking messages sent by the rabbit_channel
Expand Down Expand Up @@ -363,22 +363,22 @@ purge(Q) when ?is_amqqueue(Q) ->
QPid = amqqueue:get_pid(Q),
delegate:invoke(QPid, {gen_server2, call, [purge, infinity]}).

qpids(Qs, MsgNo) ->
qpids(Qs, Confirm, MsgNo) ->
lists:foldl(
fun ({Q, S0}, {MPidAcc, SPidAcc, Qs0, Actions0}) ->
QPid = amqqueue:get_pid(Q),
SPids = amqqueue:get_slave_pids(Q),
QRef = amqqueue:get_name(Q),
Actions = [{monitor, QPid, QRef}
| [{monitor, P, QRef} || P <- SPids]] ++ Actions0,
%% confirm record only if MsgNo isn't undefined
%% confirm record only if necessary
S = case S0 of
#?STATE{unconfirmed = U0} ->
Rec = [QPid | SPids],
U = case MsgNo of
undefined ->
U = case Confirm of
false ->
U0;
_ ->
true ->
U0#{MsgNo => #msg_status{pending = Rec}}
end,
S0#?STATE{pid = QPid,
Expand Down
36 changes: 36 additions & 0 deletions release-notes/3.9.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
RabbitMQ `3.9.8` is a maintenance release in the `3.9.x` release series.

Please refer to the **Upgrading to 3.9** section from [v3.9.0 release notes](https://github.com/rabbitmq/rabbitmq-server/releases/tag/v3.9.0) if upgrading from a version prior to 3.9.0.

This release requires at least Erlang 23.2, and supports the latest Erlang 24 version, 24.1.2 at the time of release. [RabbitMQ and Erlang/OTP Compatibility Matrix](https://www.rabbitmq.com/which-erlang.html) has more details on Erlang version requirements for RabbitMQ.



## Changes Worth Mentioning

Release notes are kept under [rabbitmq-server/release-notes](https://github.com/rabbitmq/rabbitmq-server/tree/v3.9.x/release-notes).
Contributors are encouraged to update them together with their changes. This helps with release automation and a more consistent release schedule.

### Core Server

#### Enhancements

* ...


#### Bug Fixes

* When the mandatory flag was used when publishing to classic queues,
but publisher confirms were not, channels memory usage would grow indefinitely.

GitHub issue: [#3560](https://github.com/rabbitmq/rabbitmq-server/issues/3560)


## Dependency Upgrades

* ...


## Source Code Archives

To obtain source code of the entire distribution, please download the archive named `rabbitmq-server-3.9.8.tar.xz` instead of the source tarball produced by GitHub.