[erlang-patches] fix supervisors restarting temporary children

Frédéric Trottier-Hébert <>
Wed Aug 3 17:07:06 CEST 2011

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

More information about the erlang-patches mailing list