Skip to content

Commit cc2f919

Browse files
committed
Trap exits on spawned process so it's not killed on monitor restart
rabbitmq-server#1346
1 parent 2a4ac91 commit cc2f919

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/rabbit_node_monitor.erl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,12 @@ await_cluster_recovery(Condition) ->
691691

692692
run_outside_applications(Fun, WaitForExistingProcess) ->
693693
spawn_link(fun () ->
694+
%% Ignore exit messages from the monitor - the link is needed
695+
%% to ensure the monitor detects abnormal exits from this process
696+
%% and can reset the 'restarting' status on the autoheal, avoiding
697+
%% a deadlock. The monitor is restarted when rabbit does, so messages
698+
%% in the other direction should be ignored.
699+
process_flag(trap_exit, true),
694700
%% If our group leader is inside an application we are about
695701
%% to stop, application:stop/1 does not return.
696702
group_leader(whereis(init), self()),

0 commit comments

Comments
 (0)