summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkjnilsson <knilsson@pivotal.io>2020-04-28 09:00:12 +0100
committerkjnilsson <knilsson@pivotal.io>2020-04-28 09:00:12 +0100
commit721e4e99d7b77f34e9e35205a3ad9d2f77baf1bf (patch)
tree24d77e927ebb35dc002ea546801c3eb2d974f046 /src
parent9743422413b174555f5a7990cb354d9d3d37b85d (diff)
downloadrabbitmq-server-git-721e4e99d7b77f34e9e35205a3ad9d2f77baf1bf.tar.gz
QQ: Fix crash bug when reaching delivery limit
This only happens when using basic.get but would crash the quorum queue when the delivery limit was reached due to the transient basic.get consumer being removed
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_fifo.erl20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/rabbit_fifo.erl b/src/rabbit_fifo.erl
index 940ed0d999..3a0fe2442a 100644
--- a/src/rabbit_fifo.erl
+++ b/src/rabbit_fifo.erl
@@ -1141,13 +1141,19 @@ return(#{index := IncomingRaftIdx} = Meta, ConsumerId, Returned,
return_one(MsgId, MsgNum, Msg, S0, E0,
ConsumerId)
end, {State0, Effects0}, Returned),
- #{ConsumerId := Con0} = Cons0 = State1#?MODULE.consumers,
- Con = Con0#consumer{credit = increase_credit(Con0, map_size(Returned))},
- {Cons, SQ, Effects2} = update_or_remove_sub(ConsumerId, Con, Cons0,
- SQ0, Effects1),
- State2 = State1#?MODULE{consumers = Cons,
- service_queue = SQ},
- {State, ok, Effects} = checkout(Meta, State2, Effects2),
+ {State2, Effects3} =
+ case State1#?MODULE.consumers of
+ #{ConsumerId := Con0} = Cons0 ->
+ Con = Con0#consumer{credit = increase_credit(Con0,
+ map_size(Returned))},
+ {Cons, SQ, Effects2} = update_or_remove_sub(ConsumerId, Con,
+ Cons0, SQ0, Effects1),
+ {State1#?MODULE{consumers = Cons,
+ service_queue = SQ}, Effects2};
+ _ ->
+ {State1, Effects1}
+ end,
+ {State, ok, Effects} = checkout(Meta, State2, Effects3),
update_smallest_raft_index(IncomingRaftIdx, State, Effects).
% used to processes messages that are finished