[erlang-questions] (noob-help) Supervision strategies to automatically restart dynamically added children

Jesper Louis Andersen <>
Thu Mar 3 17:59:59 CET 2011


On Wed, Mar 2, 2011 at 19:02, Dhananjay Nene <> wrote:
> While supervisors are meant to automatically restart failed processes,
> there is one scenario I am as yet unable figure out which is the
> idiomatic approach to implement crash recovery under the default OTP
> scenarios. I have considered a solution, but being a relative newbie,
> I am not sure if it is idiomatic erlang and if there are better
> solutions.
>
> Question in short : If I have a supervisor which has a number of
> dynamic children, how do I set up a mechanism where in case of a
> complete system crash, all the dynamic children restart at the point
> they were when the system (including the supervisor) crashed.

Your only chance is to evacuate the state somewhere else or make all
dangerous things happen in another process. You have to decide to
which extent you want to persist the data on disk so you can read it
in again. Personally, I would probably be looking at persisting the
game state. The alternative solution also includes another machine
that can take over the games.

There is a blog post of mine,
http://jlouisramblings.blogspot.com/2010/11/on-erlang-state-and-crashes.html
which I'll shamelessly plug because it gives some more ideas on how to
think about this.


-- 
J.


More information about the erlang-questions mailing list