summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDiana Corbacho <diana@rabbitmq.com>2017-09-04 11:15:48 +0100
committerDiana Corbacho <diana@rabbitmq.com>2017-09-04 11:19:39 +0100
commitcc2f91949ca0ccbb6c478be40a1ae5c2bb7f6531 (patch)
tree937d7d13fcf9e3eddf6f2fa675cd8b0a96842513 /src
parent2a4ac91127c36fa6c5558f5fddd1dd980b69760f (diff)
downloadrabbitmq-server-git-cc2f91949ca0ccbb6c478be40a1ae5c2bb7f6531.tar.gz
Trap exits on spawned process so it's not killed on monitor restart
rabbitmq-server#1346
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_node_monitor.erl6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/rabbit_node_monitor.erl b/src/rabbit_node_monitor.erl
index 0c317869ac..8bf79f7130 100644
--- a/src/rabbit_node_monitor.erl
+++ b/src/rabbit_node_monitor.erl
@@ -691,6 +691,12 @@ await_cluster_recovery(Condition) ->
run_outside_applications(Fun, WaitForExistingProcess) ->
spawn_link(fun () ->
+ %% Ignore exit messages from the monitor - the link is needed
+ %% to ensure the monitor detects abnormal exits from this process
+ %% and can reset the 'restarting' status on the autoheal, avoiding
+ %% a deadlock. The monitor is restarted when rabbit does, so messages
+ %% in the other direction should be ignored.
+ process_flag(trap_exit, true),
%% If our group leader is inside an application we are about
%% to stop, application:stop/1 does not return.
group_leader(whereis(init), self()),