Skip to content

Commit 9bb3636

Browse files
committed
Ignore exceptions on the msg store while terminating a client on
queue shutdown. When the msg store has crashed and the supervisor is trying to stop all its sibilings, the variable queue termination might crash as the store is not available. This would prevent the supervisor to restart the vhost, as it stops at the second crash.
1 parent bedbb03 commit 9bb3636

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/rabbit_variable_queue.erl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ terminate(_Reason, State) ->
579579
purge_pending_ack(true, State),
580580
PRef = case MSCStateP of
581581
undefined -> undefined;
582-
_ -> ok = rabbit_msg_store:client_terminate(MSCStateP),
582+
_ -> ok = maybe_client_terminate(MSCStateP),
583583
rabbit_msg_store:client_ref(MSCStateP)
584584
end,
585585
ok = rabbit_msg_store:client_delete_and_terminate(MSCStateT),
@@ -2943,3 +2943,14 @@ log_upgrade_verbose(Msg) ->
29432943

29442944
log_upgrade_verbose(Msg, Args) ->
29452945
rabbit_log_upgrade:info(Msg, Args).
2946+
2947+
maybe_client_terminate(MSCStateP) ->
2948+
%% Queue might have been asked to stop by the supervisor, it needs a clean
2949+
%% shutdown in order for the supervising strategy to work - if it reaches max
2950+
%% restarts might bring the vhost down.
2951+
try
2952+
rabbit_msg_store:client_terminate(MSCStateP)
2953+
catch
2954+
_:_ ->
2955+
ok
2956+
end.

0 commit comments

Comments
 (0)