diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-05-12 13:48:04 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-05-12 13:48:04 +0100 |
commit | 81b86fc6f048e0f9d45e56f2a615e2700469c323 (patch) | |
tree | 5bcb22c8a2ff8ab220f163560c417ae5ac99b9a3 | |
parent | 10c2f19d0576407b0148d3218d2d2fd66ca6c64e (diff) | |
download | rabbitmq-server-bug26172.tar.gz |
Monitor GM when going into a receive block.bug26172
-rw-r--r-- | src/rabbit_mirror_queue_slave.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rabbit_mirror_queue_slave.erl b/src/rabbit_mirror_queue_slave.erl index ee889f84..f18c319e 100644 --- a/src/rabbit_mirror_queue_slave.erl +++ b/src/rabbit_mirror_queue_slave.erl @@ -102,7 +102,15 @@ handle_go(Q = #amqqueue{name = QName}) -> process_flag(trap_exit, true), %% amqqueue_process traps exits too. {ok, GM} = gm:start_link(QName, ?MODULE, [self()], fun rabbit_misc:execute_mnesia_transaction/1), - receive {joined, GM} -> ok end, + MRef = erlang:monitor(process, GM), + %% We ignore the DOWN message because we are also linked and + %% trapping exits, we just want to not get stuck and we will exit + %% later. + receive + {joined, GM} -> erlang:demonitor(MRef, [flush]), + ok; + {'DOWN', MRef, _, _, _} -> ok + end, Self = self(), Node = node(), case rabbit_misc:execute_mnesia_transaction( |