From 4f9b938112a80f1c1e210b1a6af40a42f833cfa2 Mon Sep 17 00:00:00 2001
From: Fred Hebert
Date: Wed, 3 Aug 2011 10:47:36 -0400
Subject: fix supervisors restarting temporary children
In the current implementation of supervisors, temporary children
should never be restarted. However, when a temporary child is
restarted as part of a one_for_all or rest_for_one strategy where
the failing process is not the temporary child, the supervisor
still tries to restart it.
Because the supervisor doesn't keep some of the MFA information
of temporary children, this causes the supervisor to hit its
restart limit and crash.
This patch fixes the behaviour by inserting a clause in
terminate_children/2-3 (private function) that will omit temporary
children when building a list of killed processes, to avoid having
the supervisor trying to restart them again.
Only supervisors in need of restarting children used the list, so
the change should be of no impact for the functions that called
terminate_children/2-3 only to kill all children.
The documentation has been modified to make this behaviour
more explicit.
---
lib/stdlib/doc/src/supervisor.xml | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'lib/stdlib/doc/src')
diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml
index 009aa60faa..edd119d37a 100644
--- a/lib/stdlib/doc/src/supervisor.xml
+++ b/lib/stdlib/doc/src/supervisor.xml
@@ -150,9 +150,12 @@ child_spec() = {Id,StartFunc,Restart,Shutdown,Type,Modules}
Restart defines when a terminated child process
should be restarted. A permanent child process should
always be restarted, a temporary child process should
- never be restarted and a transient child process
- should be restarted only if it terminates abnormally, i.e.
- with another exit reason than normal.
+ never be restarted (even when the supervisor's restart strategy
+ is rest_for_one or one_for_all and a sibling's
+ death causes the temporary process to be terminated) and a
+ transient child process should be restarted only if
+ it terminates abnormally, i.e. with another exit reason
+ than normal.
-
Shutdown defines how a child process should be
--
cgit v1.2.3