Skip to content

Fix interrupt handling in synchronize#6527

Merged
headius merged 1 commit intojruby:jruby-9.2from
headius:fix_monitor_synchronize
Jan 13, 2021
Merged

Fix interrupt handling in synchronize#6527
headius merged 1 commit intojruby:jruby-9.2from
headius:fix_monitor_synchronize

Conversation

@headius
Copy link
Member

@headius headius commented Jan 12, 2021

The logic in MonitorMixin#mon_synchronize is broken as described
in ruby/monitor#2 due to the improper use of handle_interrupt.
This patch fixes the issue by ensuring the entire body of the
method is protected from interrupts except for the yield to the
incoming block. This avoids the ensure being interrupted, leaving
the monitor locked.

Fixes #6526

The logic in MonitorMixin#mon_synchronize is broken as described
in ruby/monitor#2 due to the improper use of handle_interrupt.
This patch fixes the issue by ensuring the entire body of the
method is protected from interrupts except for the yield to the
incoming block. This avoids the ensure being interrupted, leaving
the monitor locked.

Fixes jruby#6526
@headius headius added this to the JRuby 9.2.15.0 milestone Jan 12, 2021
@headius headius linked an issue Jan 13, 2021 that may be closed by this pull request
@headius headius merged commit 3448088 into jruby:jruby-9.2 Jan 13, 2021
@headius headius deleted the fix_monitor_synchronize branch January 13, 2021 00:10
headius added a commit to headius/jruby that referenced this pull request Jan 14, 2021
This mimics the change in CRuby 2.7 from this PR:

ruby/ruby#2576

This makes the fixes from jruby#6527 and ruby/monitor#2 irrelevant due
to the lack of Ruby interrupts in native code.
@headius headius mentioned this pull request Jan 14, 2021
headius added a commit to headius/jruby that referenced this pull request Jan 14, 2021
This mimics the change in CRuby 2.7 from this PR:

ruby/ruby#2576

This makes the fixes from jruby#6527 and ruby/monitor#2 irrelevant due
to the lack of Ruby interrupts in native code.
headius added a commit to headius/jruby that referenced this pull request Jan 14, 2021
This mimics the change in CRuby 2.7 from this PR:

ruby/ruby#2576

This makes the fixes from jruby#6527 and ruby/monitor#2 irrelevant due
to the lack of Ruby interrupts in native code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitor synchronization issue in JRuby 9.2.14.0

1 participant