Repository navigation
Conversation
8e83c85 to
63a942a
Compare
b5bdab9 to
68a7821
Compare
68a7821 to
3e84e86
Compare
| ok = terminate_one_for_all(Affected1), | ||
| {ok, NewAffected} = get_restart_children(Affected1), | ||
| {noreply, State#state{children = lists:reverse(NewAffected) ++ Rest}, | ||
| {timeout, 0, {restart_many_children, NewAffected}}}. |
There was a problem hiding this comment.
This conflicts with release-0.7 (fd66292 and acefe17).
On rebase, please switch this to the new mechanism, the same way one_for_all now does it: self() ! '$atomvm_restart_many_children' with restart_queue = restart_ids(NewAffected).
Otherwise this path brings back both problems: a call or 'EXIT' arriving mid-restart leaves the remaining children stuck in {restarting, _}, and the message carries #child{} records, so any sender can make the supervisor call an arbitrary MFA.
| {error, _} -> | ||
| NewChild = Child#child{pid = {restarting, Child#child.pid}}, | ||
| Children = lists:keyreplace(Id, #child.id, State#state.children, NewChild), | ||
| {noreply, State#state{children = Children}, {timeout, 0, {try_again_restart, Id}}} |
There was a problem hiding this comment.
restart_one and restart_simple_one helpers return {timeout, 0, {try_again_restart, Id}}. That was the bug fixed in acefe17: the next incoming message cancels the retry, so the child stays {restarting, _} forever. Please port them to self() ! '$atomvm_try_again_restart' and append Id to retry_queue, the way the current one_for_one clause on release-0.7 does. The same applies at line 633.
| case add_restart(State) of | ||
| {ok, State1} -> | ||
| case try_start(Child) of | ||
| {ok, undefined, _Result} when |
There was a problem hiding this comment.
On release-0.7, the '$atomvm_try_again_restart' handler only matches #child{pid = {restarting, _}} and re-queues with retry_queue = Ids ++ [Id]. Please carry the {ok, undefined, _} when simple_one_for_one drop branch into that handler, so the case covered by test_simple_one_for_one_ignore_on_restart still works through the retry path.
| - Added a `hex_package` build target that builds the `atomvm` Hex package, published on | ||
| hex.pm by CI when a release is tagged, so that build tools can check a project against | ||
| the AtomVM release it targets | ||
| - Added support for `rest_for_one` and `simple_one_for_one` supervisor restart strategies |
There was a problem hiding this comment.
Let's move this to 0.7.0-beta.1.
| type => worker, | ||
| modules => [?MODULE] | ||
| }, | ||
| {ok, {#{strategy => simple_one_for_one, intensity => 10, period => 60}, [Template]}}; |
There was a problem hiding this comment.
Every failed retry calls add_restart, and the retry loop runs back-to-back. With intensity 10, the supervisor can shut down before terminate_child/2 gets in, especially on SMP builds. Today the test likely passes partly because the call cancels the {timeout, 0} retry, and that changes after the rebase. Please raise the intensity (e.g. 1000), or make the worker fail a bounded number of times and then block.
There was a problem hiding this comment.
release-0.7 has test_restart_survives_messages_one_for_all and test_retry_survives_messages_one_for_one. A rest_for_one version, where a which_children call or an unrelated 'EXIT' arrives during a partial restart, would guard the rebased path above.
For simple_one_for_one, drop a dynamic child whose restart returns ignore and let terminate_child/2 cancel a pending restart by the original pid, as OTP does. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
3e84e86 to
35eafd7
Compare

These changes are made under both the "Apache 2.0" and the "GNU Lesser General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later