Skip to content

Interrupt fibers waiting through the scheduler when their IO closes - #9760

Merged
headius merged 2 commits into
jruby:masterfrom
sampokuokkanen:scheduler-close-interrupt
Oct 2, 2026
Merged

headius merged 2 commits into
jruby:masterfrom
sampokuokkanen:scheduler-close-interrupt

Conversation

@sampokuokkanen

Copy link
Copy Markdown
Contributor

IO#close interrupted threads blocked on the IO, but not fibers parked in the fiber scheduler's io_wait, so they kept waiting on a closed IO. Track those waits and, after releasing the IO lock, hand each fiber an IOError through the scheduler's fiber_interrupt, or raise it in the fiber's thread if the scheduler has no such hook, like MRI.

This lets TestFiberIOClose#test_io_close_across_fibers run again. It was just disabled in #9750.

IO#close interrupted threads blocked on the IO, but not fibers parked
in the fiber scheduler's io_wait, so they kept waiting on a closed IO.
Track those waits and, after releasing the IO lock, hand each fiber an
IOError through the scheduler's fiber_interrupt, or raise it in the
fiber's thread if the scheduler has no such hook, like MRI.

This lets TestFiberIOClose#test_io_close_across_fibers run again.

@headius headius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On minor change but it looks good.

Comment thread core/src/main/java/org/jruby/util/io/OpenFile.java Outdated
@sampokuokkanen
sampokuokkanen requested a review from headius October 1, 2026 23:11
@headius headius added this to the JRuby 10.1.3.0 milestone Oct 2, 2026
@headius
headius merged commit ef6482a into jruby:master Oct 2, 2026
134 of 135 checks passed
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.

2 participants