diff options
| author | Matthias Radestock <matthias@rabbitmq.com> | 2012-04-27 11:10:49 +0100 |
|---|---|---|
| committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-04-27 11:10:49 +0100 |
| commit | bbdf65092a9cb418101f68e44b09eb9c3496911b (patch) | |
| tree | 6c4087ac2c33f5b217bd4c76009e497dcbf66659 | |
| parent | f6a1c4b9efefc9da018140aea8e75dd3377aa8c5 (diff) | |
| download | rabbitmq-server-git-bbdf65092a9cb418101f68e44b09eb9c3496911b.tar.gz | |
properly ignore dynamic children that return 'ignore' from init/1
thus preventing an explosion on supervisor shutdown when we would
otherwise trip over unlinking an 'undefined' pid.
| -rw-r--r-- | src/supervisor2.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/supervisor2.erl b/src/supervisor2.erl index f1b748787a..3d3623d752 100644 --- a/src/supervisor2.erl +++ b/src/supervisor2.erl @@ -411,6 +411,8 @@ handle_call({start_child, EArgs}, _From, State) when ?is_simple(State) -> #child{mfa = {M, F, A}} = hd(State#state.children), Args = A ++ EArgs, case do_start_child_i(M, F, Args) of + {ok, undefined} -> + {reply, {ok, undefined}, State}; {ok, Pid} -> NState = State#state{dynamics = ?DICT:store(Pid, Args, State#state.dynamics)}, @@ -743,6 +745,8 @@ restart(Strategy, Child, State, Restart) #child{mfa = {M, F, A}} = Child, Dynamics = ?DICT:erase(Child#child.pid, State#state.dynamics), case do_start_child_i(M, F, A) of + {ok, undefined} -> + {ok, State}; {ok, Pid} -> NState = State#state{dynamics = ?DICT:store(Pid, A, Dynamics)}, {ok, NState}; |
