[erlang-bugs] Supervisor.erl erroreously removes the child_spec on reaching max_restart_intensity

Matthew Sackman matthew@REDACTED
Fri Aug 20 17:42:43 CEST 2010


Hello? Anyone out there who looks after supervisor?

On Mon, Aug 09, 2010 at 04:41:12PM +0100, Matthew Sackman wrote:
> It doesn't actually cause a crash, but in the following:
> 
> restart(Child, State) ->
>     case add_restart(State) of
> 	{ok, NState} ->
> 	    restart(NState#state.strategy, Child, NState, fun restart/2);
> 	{terminate, NState} ->
> 	    report_error(shutdown, reached_max_restart_intensity,
> 			 Child, State#state.name),
> 	    {shutdown, remove_child(Child, NState)}
>     end.
> 
> the call to remove_child is wrong. It removes the child spec. In the
> case of a simple_one_for_one, that then means that in terminate, we have
> a pid in the dynamics dictionary, but no child spec at all, whilst in
> the case of non simple_one_for_one the spec is simply not there.
> 
> This doesn't cause any crashes, but it means the state is inconsistent
> in the subsequent terminate function. It should be a call to
> state_del_child (blank the child pid in the non-simple case, or remove
> the pid from the dynamics dict for the simple case).
> 
> Matthew
> 
> ________________________________________________________________
> erlang-bugs (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-bugs-unsubscribe@REDACTED
> 


More information about the erlang-bugs mailing list