[erlang-patches] Fix one_for_all and rest_for_one supervisor multiple restarts

James Fish james@REDACTED
Thu Apr 4 14:05:49 CEST 2013


Hi,

When a child in a rest_for_one or one_for_all supervisor dies and is then
restarted but a child later in the child specification fails to start - so
that the restart fails - the restarted child's pid is ignored by the
supervisor and is not terminated. The supervisor will then attempt to
restart that child again - leaving the unaccounted for process alive!

An example of this is available here:
https://gist.github.com/fishcakez/5296408

In this patch the supervisor changes the restarting child to the one that
failed to start. In the case of one_for_all this means that the
successfully restarted child is terminated (along with the other
successfully restarted children). In the case of rest_for_one all
successfully restarted children remain, and restarting begins with the
child that failed to start. Should this be document? The way a rest_for_one
handles this case is not documented.

git fetch git://github.com/fishcakez/otp.git fix-server-multi-restart

https://github.com/fishcakez/otp/compare/fix-supervisor-multi-restart
https://github.com/fishcakez/otp/compare/fix-supervisor-multi-restart.patch

King Regards,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130404/d78559e5/attachment.htm>


More information about the erlang-patches mailing list