Skip to content

Commit d48ed6d

Browse files
Merge pull request #3560 from rabbitmq/lh-fix-mandatory-flag
Fix memory leak when using mandatory flag in CQs
2 parents 84b0ade + 7ffb154 commit d48ed6d

File tree

2 files changed

+43
-7
lines changed

2 files changed

+43
-7
lines changed

deps/rabbit/src/rabbit_classic_queue.erl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,9 @@ settlement_action(Type, QRef, MsgSeqs, Acc) ->
301301
deliver(Qs0, #delivery{flow = Flow,
302302
msg_seq_no = MsgNo,
303303
message = #basic_message{exchange_name = _Ex},
304-
confirm = _Confirm} = Delivery) ->
304+
confirm = Confirm} = Delivery) ->
305305
%% TODO: record master and slaves for confirm processing
306-
{MPids, SPids, Qs, Actions} = qpids(Qs0, MsgNo),
306+
{MPids, SPids, Qs, Actions} = qpids(Qs0, Confirm, MsgNo),
307307
QPids = MPids ++ SPids,
308308
case Flow of
309309
%% Here we are tracking messages sent by the rabbit_channel
@@ -363,22 +363,22 @@ purge(Q) when ?is_amqqueue(Q) ->
363363
QPid = amqqueue:get_pid(Q),
364364
delegate:invoke(QPid, {gen_server2, call, [purge, infinity]}).
365365

366-
qpids(Qs, MsgNo) ->
366+
qpids(Qs, Confirm, MsgNo) ->
367367
lists:foldl(
368368
fun ({Q, S0}, {MPidAcc, SPidAcc, Qs0, Actions0}) ->
369369
QPid = amqqueue:get_pid(Q),
370370
SPids = amqqueue:get_slave_pids(Q),
371371
QRef = amqqueue:get_name(Q),
372372
Actions = [{monitor, QPid, QRef}
373373
| [{monitor, P, QRef} || P <- SPids]] ++ Actions0,
374-
%% confirm record only if MsgNo isn't undefined
374+
%% confirm record only if necessary
375375
S = case S0 of
376376
#?STATE{unconfirmed = U0} ->
377377
Rec = [QPid | SPids],
378-
U = case MsgNo of
379-
undefined ->
378+
U = case Confirm of
379+
false ->
380380
U0;
381-
_ ->
381+
true ->
382382
U0#{MsgNo => #msg_status{pending = Rec}}
383383
end,
384384
S0#?STATE{pid = QPid,

release-notes/3.9.8.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
RabbitMQ `3.9.8` is a maintenance release in the `3.9.x` release series.
2+
3+
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.
4+
5+
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.
6+
7+
8+
9+
## Changes Worth Mentioning
10+
11+
Release notes are kept under [rabbitmq-server/release-notes](https://github.com/rabbitmq/rabbitmq-server/tree/v3.9.x/release-notes).
12+
Contributors are encouraged to update them together with their changes. This helps with release automation and a more consistent release schedule.
13+
14+
### Core Server
15+
16+
#### Enhancements
17+
18+
* ...
19+
20+
21+
#### Bug Fixes
22+
23+
* When the mandatory flag was used when publishing to classic queues,
24+
but publisher confirms were not, channels memory usage would grow indefinitely.
25+
26+
GitHub issue: [#3560](https://github.com/rabbitmq/rabbitmq-server/issues/3560)
27+
28+
29+
## Dependency Upgrades
30+
31+
* ...
32+
33+
34+
## Source Code Archives
35+
36+
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.

0 commit comments

Comments
 (0)