-
Notifications
You must be signed in to change notification settings - Fork 130
Fix several supervisor issues and bugs #1958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fix a missing edge case in loop_terminate/2 that could lead to loop_wait_termination/1 getting stuck in an endless receive, preventing shutdown, if a later child crashes before loop_terminate/2 has itterated through the children to the now dead one. Fixes a typo in the init funtion error return where the atom `mod` was returned rather than the modules name (`Mod`). Fixes a typo in child record `type`, adds missing parenthesis on the `child_type/0` type. Signed-off-by: Winford <[email protected]>
Fixes some tests to catch the messages from child ping_pong_servers so they will not be received by later tests. Changes the supervisor started in test_count_children to use a generic supervisor without a child, rather than using the modules start_link which always starts a child ping_pong_server that sends messages back to the test environment. Fixes the test_ping_ping final `recieve` to match on a new `Pid4` (which would indicate a restart) rather than `Pid3` that the monitor just caught the 'DOWN' message for. Signed-off-by: Winford <[email protected]>
Adds support for handling restarts for the `one_for_all` strategy that was documented, but lacked implimentation. Closes atomvm#1855 Signed-off-by: Winford <[email protected]>
Adds support for honoring intensity and period supervisor options, allowing the prevention of endless crash and restarts by misbehaving children. Adds a test to ensure the settings work as expected on AtomVM and match OTP. Closes atomvm#1915 Signed-off-by: Winford <[email protected]>
| {error, no_supervisor2} | ||
| end, | ||
| ok = | ||
| case is_pid(ChildPid) of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
believe you want ChildPid2 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I do! Thank you. I reworked this function a bit too, I decided it was a waist of CI time to wait 2000 ms for a child message if the supervisor failed to start 🤦 . I moved the check for a supervisor pid sooner and a fixed the variable name.
Fixes a function clause exception that would crash the supervisor if a child fails to restart by matching the same behavior as OTP, and continue to try restarting the child until success, or maximum `intensity` is reached within the allowed `period`. Closed atomvm#1957 Signed-off-by: Winford <[email protected]>
e0f3afd to
7b2435d
Compare
These changes fix several open supervisor issues, as well as a few small bugs discovered in the supervisor and test_supervisor.erl.
one_for_allrestart strategy that is documented in the module.intensityandperiodoptions.test_supervisor:/test/0.Closes #1855
Closes #1915
Closed #1957
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