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
2) Restarts are only done (and restart intensity exhausted)
by *illegal* terminations. Each child has a permanence (temporary,
transient or permanent) defining when it terminates illegally.
If explicit terminations done through the API shall be counted,
the semantics of illegal terminations must be extended to
cover different types of API initiated terminations.
>> When I call
>> supervisor:terminate_child(ThisSuper, ThatChild),
>> supervisor:restart_child(ThisSuper, ThatChild).
>> Then the supervisor doesn't count this towards the restart
>> frequency. That is, I can do this forever, and the supervisor will
>> never escalate.
>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
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
I have no problem with this behaviour. However, it could be stated
explicitly in the manual.
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