summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiana Corbacho <diana@rabbitmq.com>2017-04-19 14:03:24 +0100
committerDiana Corbacho <diana@rabbitmq.com>2017-04-21 11:29:02 +0100
commit9bb3636e654e693a24183ab6eaeb0698c1b62a13 (patch)
treeb9f9d4c9b9e61b576645972bbf1402dfd7f79a90
parentbedbb035ebfae084f5efca97e072e2ae013d13ac (diff)
downloadrabbitmq-server-git-9bb3636e654e693a24183ab6eaeb0698c1b62a13.tar.gz
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.
-rw-r--r--src/rabbit_variable_queue.erl13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index 599045b01f..86321003c9 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -579,7 +579,7 @@ terminate(_Reason, State) ->
purge_pending_ack(true, State),
PRef = case MSCStateP of
undefined -> undefined;
- _ -> ok = rabbit_msg_store:client_terminate(MSCStateP),
+ _ -> ok = maybe_client_terminate(MSCStateP),
rabbit_msg_store:client_ref(MSCStateP)
end,
ok = rabbit_msg_store:client_delete_and_terminate(MSCStateT),
@@ -2943,3 +2943,14 @@ log_upgrade_verbose(Msg) ->
log_upgrade_verbose(Msg, Args) ->
rabbit_log_upgrade:info(Msg, Args).
+
+maybe_client_terminate(MSCStateP) ->
+ %% Queue might have been asked to stop by the supervisor, it needs a clean
+ %% shutdown in order for the supervising strategy to work - if it reaches max
+ %% restarts might bring the vhost down.
+ try
+ rabbit_msg_store:client_terminate(MSCStateP)
+ catch
+ _:_ ->
+ ok
+ end.