summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-08-09 18:59:24 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-08-09 18:59:24 +0100
commite5f4b173f598d084a9796b16544cff6c1846ccbf (patch)
tree0ea49d7f3e0d3e2d4be5963356e721ade505a5d0 /src
parent638724edbe75aa9c4414550b449c8e622b6777dc (diff)
downloadrabbitmq-server-git-e5f4b173f598d084a9796b16544cff6c1846ccbf.tar.gz
When a supervisor is killing off its children, if its children have already exited normally, don't class it as an error - after all, the supervisor traps_exits, so the relevant exit signals will likely already be in the supervisor's mailbox
Diffstat (limited to 'src')
-rw-r--r--src/supervisor2.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl
index 773d67d333..5cb2c301b4 100644
--- a/src/supervisor2.erl
+++ b/src/supervisor2.erl
@@ -695,10 +695,13 @@ shutdown(Pid, Time) ->
ok ->
exit(Pid, shutdown), %% Try to shutdown gracefully
receive
- {'DOWN', _MRef, process, Pid, shutdown} ->
- ok;
- {'DOWN', _MRef, process, Pid, OtherReason} ->
- {error, OtherReason}
+ {'DOWN', _MRef, process, Pid, Reason} ->
+ case Reason of
+ normal -> ok;
+ shutdown -> ok;
+ noproc -> ok;
+ _ -> {error, Reason}
+ end
after Time ->
exit(Pid, kill), %% Force termination.
receive
@@ -726,7 +729,12 @@ monitor_child(Pid) ->
{'EXIT', Pid, Reason} ->
receive
{'DOWN', _, process, Pid, _} ->
- {error, Reason}
+ case Reason of
+ normal -> ok;
+ shutdown -> ok;
+ noproc -> ok;
+ _ -> {error, Reason}
+ end
end
after 0 ->
%% If a naughty child did unlink and the child dies before