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/src/supervisor.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/stdlib/src') diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl index 67655b1145..1d7396adee 100644 --- a/lib/stdlib/src/supervisor.erl +++ b/lib/stdlib/src/supervisor.erl @@ -381,7 +381,7 @@ handle_call({start_child, EArgs}, _From, State) when ?is_simple(State) -> #child{mfargs = {M, F, A}} = Child, Args = A ++ EArgs, case do_start_child_i(M, F, Args) of - {ok, undefined} when Child#child.restart_type =:= temporary -> + {ok, undefined} -> {reply, {ok, undefined}, State}; {ok, Pid} -> NState = save_dynamic_child(Child#child.restart_type, Pid, Args, State), -- cgit v1.2.3