summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Klishin <mklishin@pivotal.io>2017-07-05 14:05:50 +0300
committerMichael Klishin <mklishin@pivotal.io>2017-07-05 14:05:50 +0300
commitedad23196d7f0454d7409786071321a19262b3a6 (patch)
tree0fc24d54c6ca3cc3bdf7dfe4b21fdfa1ecfb164d /src
parentd97d2ef0d0e769268b4cf624753dad27c2bcc8d5 (diff)
downloadrabbitmq-server-git-edad23196d7f0454d7409786071321a19262b3a6.tar.gz
Virtual host watcher: stop vhost's top level supervisor instead of exiting
Per suggestion from @hairyhum. This should be a safer option when rabbit.vhost_restart_strategy is set to stop_node.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_vhost_sup_watcher.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rabbit_vhost_sup_watcher.erl b/src/rabbit_vhost_sup_watcher.erl
index 7d9f941040..9c166e5b98 100644
--- a/src/rabbit_vhost_sup_watcher.erl
+++ b/src/rabbit_vhost_sup_watcher.erl
@@ -52,7 +52,14 @@ handle_info(check_vhost, VHost) ->
rabbit_log:error("Virtual host '~s' is gone. "
"Stopping message store supervisor.",
[VHost]),
- {stop, normal, VHost}
+ %% Stop vhost's top supervisor in a one-off process to avoid a deadlock:
+ %% us (a child process) waiting for supervisor shutdown and our supervisor(s)
+ %% waiting for us to shutdown.
+ spawn(
+ fun() ->
+ rabbit_vhost_sup_sup:stop_and_delete_vhost(VHost)
+ end),
+ {noreply, VHost}
end;
handle_info(_, VHost) ->
{noreply, VHost}.