Fix heartbeater exception exit

Before this commit test AlarmsTest.diskAlarmShouldNotPreventConsumption
of the Java client was failing.
When executing that test, the server failed with:

2021-06-25 16:11:02.886935+02:00 [error] <0.1301.0>     exception exit: {unexpected_message,resume}
2021-06-25 16:11:02.886935+02:00 [error] <0.1301.0>       in function  rabbit_heartbeat:heartbeater/3 (src/rabbit_heartbeat.erl, line 138

because the heartbeater was tried to be resumed without being paused
before.

Above exception exit also happens on master branch when executing this
test. However, the test falsely succeeds on master because the following FIXME was
never implemented:
8e569ad8bf/deps/rabbitmq_stream/src/rabbit_stream_reader.erl (L778)
This commit is contained in:
David Ansari 2021-06-26 13:53:47 +02:00
parent 8c4e2e009d
commit 896d879f8d
1 changed files with 7 additions and 2 deletions

View File

@ -1217,7 +1217,7 @@ handle_frame_pre_auth(_Transport,
socket = Sock,
name = ConnectionName} =
Connection,
State,
#stream_connection_state{blocked = Blocked} = State,
{tune, FrameMax, Heartbeat}) ->
rabbit_log_connection:debug("Tuning response ~p ~p ", [FrameMax, Heartbeat]),
Parent = self(),
@ -1239,7 +1239,12 @@ handle_frame_pre_auth(_Transport,
SendFun,
Heartbeat,
ReceiveFun),
case Blocked of
true ->
ok = rabbit_heartbeat:pause_monitor(Heartbeater);
_ ->
ok
end,
{Connection#stream_connection{connection_step = tuned,
frame_max = FrameMax,
heartbeat = Heartbeat,