[erlang-patches] fix supervisors restarting temporary children
Tue Aug 23 09:48:05 CEST 2011
On 08/03/2011 05:07 PM, Frédéric Trottier-Hébert wrote:
> git fetch :ferd/otp.git fix_supervisor_temporary_restart
> This patch fixes the issue discussed at http://erlang.org/pipermail/erlang-questions/2011-August/060419.html, namely that in one_for_all or rest_for_one strategies, the supervisor is still trying to restart temporary children. Because we don't track their MFAs entirely, this causes repetitive crashes.
> This patch fixes the behaviour by inserting a clause in terminate_children/2-3 (private function) that will omit temporary children when building a list of killed processes, to avoid having the supervisor trying to restart them again.
> Only supervisors in need of restarting children used the list, so the change should be of no impact for the functions that called terminate_children/2-3 only to kill all children. This also avoids useless iterations if the filtering step were to be inserted at any other point in the code.
> A test suite has been added to supervisor_SUITE, containing checks for both one_for_all and rest_for_one. I've only ran the tests for the suite itself, but all of them pass without a problem.
> The commit/diff itself: https://github.com/ferd/otp/commit/25aab8efdef5c6898a679705158627cded3f847a
> Fred Hébert
> erlang-patches mailing list
Your patch has been reviewed, and we want you to fix the following for
it to be graduated.
1) I think the test needs to be extended a bit. I can't see that it
checks what happens to the temporary child - i.e. that it is terminated
but not restarted. As far as I can understand it only checks that the
2) There is a minor typo in the description of the test - it says
one_for_rest instead of rest_for_one.
3) The behaviour must be documented - i.e. it must be explicitly stated
that temporary children under one_for_all or rest_for_one supervisors
will be terminated but not restarted.
/Henrik Nord Erlang/OTP
More information about the erlang-patches