Supervision Restart Strategies

Vance Shipley vances@REDACTED
Sat Jan 10 07:34:24 CET 2004

I would like to support a restart strategy which doesn't
seem to be supported in current OTP.

A supervisor will exit when the maximum restart frequency
has been reached.  Given a restart strategy of
{one_for_one, 10, 60} effectively once there have been
10 exceptions within 60 seconds the supervisor will exit.
I say this because they are permanent processes and so
they will never exit normally.  If they needed to be
restarted it's because there was an exception.

This is a handy mechanism as once you start to get too
many errors you can fail a larger portion of the system 
and restart it further up.  This can continue until you
have rebooted the OS of the node.

If the supervisor has transient children it will also
exit if there are too many exceptions.  This restart
type allows processes to come into existance and exit
normally.  Only if they do not exit normally are they 
restarted.  Temporary children are never restarted.

What is missing is a stategy to restart the supervisor
when there have been too many exceptions without actually
restarting a dynamic process.  I would like to have a
{simple_one_for_one, 10, 60} restart strategy where I
start temporary children with supervisor:start_child/2.
As long as all children exit normally they simply stop.
If they exit abnormally it counts as a restart in the
restart strategy however the child should not be restarted.


More information about the erlang-questions mailing list