diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-10-10 16:32:18 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-10-10 16:32:18 +0100 |
commit | 752996f2f749ba9907e657705fa63982212bbcdb (patch) | |
tree | b95b84731a0b7ea2fbdbedf32a58f7923c567a1a | |
parent | 067c3175dd84bd6b401ae6c818918746f2c48162 (diff) | |
download | rabbitmq-server-bug26404.tar.gz |
Also avoid partition-related hangs here.bug26404
-rw-r--r-- | src/rabbit_mirror_queue_master.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/rabbit_mirror_queue_master.erl b/src/rabbit_mirror_queue_master.erl index f1b1a8a5..aa1e1ab9 100644 --- a/src/rabbit_mirror_queue_master.erl +++ b/src/rabbit_mirror_queue_master.erl @@ -201,9 +201,15 @@ delete_and_terminate(Reason, State = #state { backing_queue = BQ, stop_all_slaves(Reason, #state{name = QName, gm = GM}) -> {ok, #amqqueue{slave_pids = SPids}} = rabbit_amqqueue:lookup(QName), - MRefs = [erlang:monitor(process, Pid) || Pid <- [GM | SPids]], + PidsMRefs = [{Pid, erlang:monitor(process, Pid)} || Pid <- [GM | SPids]], ok = gm:broadcast(GM, {delete_and_terminate, Reason}), - [receive {'DOWN', MRef, process, _Pid, _Info} -> ok end || MRef <- MRefs], + %% It's possible that we could be partitioned from some slaves + %% between the lookup and the broadcast, in which case we could + %% monitor them but they would not have received the GM + %% message. So only wait for slaves which are still + %% not-partitioned. + [receive {'DOWN', MRef, process, _Pid, _Info} -> ok end + || {Pid, MRef} <- PidsMRefs, rabbit_mnesia:on_running_node(Pid)], %% Normally when we remove a slave another slave or master will %% notice and update Mnesia. But we just removed them all, and %% have stopped listening ourselves. So manually clean up. |