Implement supervisor failure escalation#2
Merged
Conversation
When a supervisor exhausts its restart intensity (max_restarts within max_seconds), it now exits with an error reason that propagates up the supervision tree via links. Changes: - Add set_exit_reason/set_exit_reason_async to task-local context - ProcessScope::run now returns Option<ExitReason> for custom exit - spawn_internal uses custom exit reason if set, otherwise Normal - Supervisor sets exit reason before returning on: - Initial child start failure - Max restart intensity reached - Received exit signal Tests added: - test_supervisor_exits_with_error_on_max_restarts - test_failure_escalation_to_parent_supervisor - test_transient_child_normal_exit_no_restart - test_transient_child_abnormal_exit_restarts - test_temporary_child_never_restarts Closes #1.
c765b5b to
062cc0a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a supervisor exhausts its restart intensity (max_restarts within max_seconds), it now exits with an error reason that propagates up the supervision tree via links. This implements proper OTP-style failure escalation.
Changes
set_exit_reason/set_exit_reason_asyncto task-local contextProcessScope::runnow returnsOption<ExitReason>for custom exit reasonsspawn_internaluses custom exit reason if set, otherwiseNormalTest plan
test_supervisor_exits_with_error_on_max_restarts- Verifies supervisor exits with error when restart limit hittest_failure_escalation_to_parent_supervisor- Verifies child supervisor failure propagates to parenttest_transient_child_normal_exit_no_restart- Verifies transient children don't restart on normal exittest_transient_child_abnormal_exit_restarts- Verifies transient children restart on abnormal exittest_temporary_child_never_restarts- Verifies temporary children never restartCloses #1