Deliver exception-construction failures to the timed-out thread - #121
Open
OskarEichler wants to merge 1 commit into
Open
Deliver exception-construction failures to the timed-out thread#121OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
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
If Thread#raise fails with a StandardError while constructing/validating the requested exception, deliver that failure to the affected thread instead of letting it terminate the shared watcher. Preserve deferred exception construction for successful operations.
Reproduction
Before this patch the construction error terminates the shared watcher, and an already pending unrelated timeout stops firing too. Bounded concurrent checks reproduce and verify both outcomes with an invalid exception class and a constructor raising ArgumentError. Additional checks confirm normal custom classes/messages and that successful operations still do not construct an exception.
Verification
295667aac44220ddfd10db014e766ae8d313cfb8.bundle exec rake test: 36 tests / 81 assertions / zero failures or errors, baseline and this branch. Includes the existing signal, fork, Ractor, exception and mocked-scheduler cases.git diff --checkpass. Supplemental RuboCop Lint retains the same two existing offenses; no lint-clean claim.Compatibility and limitations
Malformed exception definitions now report their StandardError to the timed operation instead of silently disabling timeouts. Valid timeout exception behavior and deferred construction remain unchanged (including the historical #9354 rationale). This is not a sandbox for arbitrary exception callbacks: SystemExit/other non-StandardError exceptions, blocking constructors or a failure while raising the replacement error are outside this patch.
The same runtime file is shipped in 0.6.1; this patch can be adopted without a release upgrade. Ruby >= 2.6 and the empty runtime dependency set remain unchanged. No production access or external network diagnostic was used; other Ruby/OS combinations and full scheduler implementations were not run locally.