Supervisor.erl erroreously removes the child_spec on reaching max_restart_intensity
Matthew Sackman
matthew@REDACTED
Mon Aug 9 17:41:12 CEST 2010
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
More information about the erlang-bugs
mailing list