From 000c33662b8a98870a97a3499076895d4e832563 Mon Sep 17 00:00:00 2001 From: James Fish Date: Wed, 4 Mar 2015 23:10:25 +0000 Subject: Don't store child that returns ignore in simple supervisor If a child of a simple_one_for_one returns ignore from its start function no longer store the child for any restart type. It is not possible to restart or delete the child because the supervisor is a simple_one_for_one. Previously a simple_one_for_one would crash, potentially without shutting down all of its children, when it tried to shutdown a child with undefined pid. Previous only one undefined pid child was stored in a simple_one_for_one supervisor no matter how many times the child start function returned ignore. --- lib/stdlib/doc/src/supervisor.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/stdlib/doc') diff --git a/lib/stdlib/doc/src/supervisor.xml b/lib/stdlib/doc/src/supervisor.xml index ffac1c0bd7..6ff477a42d 100644 --- a/lib/stdlib/doc/src/supervisor.xml +++ b/lib/stdlib/doc/src/supervisor.xml @@ -386,9 +386,15 @@ added to the supervisor and the function returns the same value.

If the child process start function returns ignore, - the child specification is added to the supervisor, the pid - is set to undefined, and the function returns - {ok,undefined}.

+ the child specification is added to the supervisor (unless the + supervisor is a simple_one_for_one supervisor, see below), + the pid is set to undefined and the function returns + {ok,undefined}. +

+

In the case of a simple_one_for_one supervisor, when a child + process start function returns ignore the functions returns + {ok,undefined} and no child is added to the supervisor. +

If the child process start function returns an error tuple or an erroneous value, or if it fails, the child specification is discarded, and the function returns {error,Error} where -- cgit v1.2.3