summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2014-05-12 13:48:04 +0100
committerSimon MacMullen <simon@rabbitmq.com>2014-05-12 13:48:04 +0100
commit81b86fc6f048e0f9d45e56f2a615e2700469c323 (patch)
tree5bcb22c8a2ff8ab220f163560c417ae5ac99b9a3
parent10c2f19d0576407b0148d3218d2d2fd66ca6c64e (diff)
downloadrabbitmq-server-bug26172.tar.gz
Monitor GM when going into a receive block.bug26172
-rw-r--r--src/rabbit_mirror_queue_slave.erl10
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(