supervisor:restart_child/2

Ulf Wiger <>
Fri Feb 23 17:01:05 CET 2001


On Fri, 23 Feb 2001, Lennart  Öhman wrote:

>Hi everyone!
>
>There are several reasons to this:
>1) If the supervisor would count your explicit manipulations,
>do you want it to immediately restart a terminated child? Most
>often not. Therefore this management must be done outside the
>restart intensity.

Well, I'm not sure I agree with that interpretation. Obviously, it's
not desireable that a terminate_child/2 would cause the child to
immediately restart. That doesn't automatically mean that an ordered
restart shouldn't be counted towards the restart frequency.

However, a call to terminate_child/2 causes the child to die with
reason = shutdown. Even though it's not really stated in the manual,
this should count as a normal exit. According to the manual then, the
child will not be restarted.

However, if a supervisor escalates, or a supervisor with one_for_all
or rest_for_one supervision detects a child crash, other children may
be terminated with reason = shutdown, and then immediately restarted.
Thus, the child cannot make an assumption that.... actually, with the
current supervisor, the child can never make _any_ assumptions,
because it has no way of finding out why it is being started.

Regardless, the manual should be interpreted as implying that 
explicit terminate_child()/restart_child() operations do not count
as non-normal exits. Thus, the implied semantics (by omission, if
nothing else) of these functions are that they cannot trigger an
escalated restart.

I have no problem with this behaviour. However, it could be stated
explicitly in the manual.

/Uffe
-- 
Ulf Wiger                                    tfn: +46  8 719 81 95
Senior System Architect                      mob: +46 70 519 81 95
Strategic Product & System Management    ATM Multiservice Networks
Data Backbone & Optical Services Division      Ericsson Telecom AB




More information about the erlang-questions mailing list