Initial hack to avoid exceptions in sleep wakes#9144
Draft
headius wants to merge 1 commit intojruby:10.1-devfrom
Draft
Initial hack to avoid exceptions in sleep wakes#9144headius wants to merge 1 commit intojruby:10.1-devfrom
headius wants to merge 1 commit intojruby:10.1-devfrom
Conversation
As described in jruby#9140, sleep logic in JRuby based on a lock currently wakes that sleep by triggering an InterruptedException. This adds significant overhead to every such wake-up operation, and is generally unnecessary if the thread doing the waking owns the lock and could simply signal it. This attempts to reduce the chances that an InterruptedException will be triggered by first trying to signal the condition associated with the lock. If the lock is not owned, this will trigger an IllegalMonitorStateException and we proceed to the previous interrupt logic. This does mean that non-owned lock wake-ups will have double the performance hit they did before, but such cases are generally only to shock a thread out of a lock sleep. This fix is also not ready for prime-time and will be pushed as a draft until we properly handle all lock-sleep uses without triggering any exceptions.
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.
As described in #9140, sleep logic in JRuby based on a lock currently wakes that sleep by triggering an
InterruptedException. This adds significant overhead to every such wake-up operation, and is generally unnecessary if the thread doing the waking owns the lock and could simply signal it.
This attempts to reduce the chances that an InterruptedException will be triggered by first trying to signal the condition associated with the lock. If the lock is not owned, this will trigger an IllegalMonitorStateException and we proceed to the previous interrupt logic.
This does mean that non-owned lock wake-ups will have double the performance hit they did before, but such cases are generally only to shock a thread out of a lock sleep. This fix is also not ready for prime-time and will be pushed as a draft until we properly handle all lock-sleep uses without triggering any exceptions.