diff options
author | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-09 18:59:24 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@rabbitmq.com> | 2010-08-09 18:59:24 +0100 |
commit | 638000f10c8eae60982d8f4184308884a5ed9216 (patch) | |
tree | 0ea49d7f3e0d3e2d4be5963356e721ade505a5d0 | |
parent | d08175070c9e38e9d9993ea8e1abf046c4b95732 (diff) | |
download | rabbitmq-server-638000f10c8eae60982d8f4184308884a5ed9216.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
-rw-r--r-- | src/supervisor2.erl | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index 773d67d3..5cb2c301 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 |