Skip to content

Improve JRuby selector compatibility - #193

Open
samuel-williams-shopify wants to merge 4 commits into
mainfrom
jruby-selector-compat
Open

samuel-williams-shopify wants to merge 4 commits into
mainfrom
jruby-selector-compat

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Summary

  • improve pure Ruby selector compatibility with JRuby by avoiding unsupported IO::Buffer operations and using nonblocking Ruby IO methods where needed
  • make Selector.nonblock restore nonblocking state explicitly and ensure the helper is loaded for the pure Ruby selector
  • add targeted JRuby skips for VM/platform gaps around nested fiber transfer, closed-IO scheduling, FIFO channels, TCP OOB priority readiness, and UNIXSocket buffer sizing
  • keep the branch based directly on main, without the old fork diagnostic workflow/test commits

Verification

  • bundle exec rubocop
  • bundle exec bake test

Note: this replaces the old interrupt-fix PR branch.

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor Author

cc @headius

Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
Assisted-By: devx/242ffd92-f36a-421a-88b9-270e5488162a
@headius

headius commented Jun 25, 2026

Copy link
Copy Markdown

I'll jump in to help where I can!

@ioquatix

Copy link
Copy Markdown
Member

@headius I filed a few upstream bug reports on JRuby.

IO::Buffer is not set in stone yet, but IO::Buffer#read and #write may not follow the current spec which is making things more tricky than it should be.

Also, what's the current state of Loom/io_uring etc? Just wondering if it would make sense to create a JNI for better IO. How crazy would that be?

@sampokuokkanen

sampokuokkanen commented Oct 28, 2026 •

Copy link
Copy Markdown

@ioquatix @headius
A status update!

I ran io-event main against current JRuby master, and most of the JRuby skips here aren't needed anymore. These pass now:

  • #wakeup from a different thread (both)
  • exception raised during wait from another fiber on the same IO
  • closed_io (both)
  • interruptable
  • nonblock.rb nonblock? check
  • queue "can yield from resumed fiber"

The IO::Buffer#read/#write fallback isn't needed either: JRuby has both, and the suite passes with the library as it is on main.

Fixes in progress:

Still needed:

With those in, the only JRuby failure left on macOS is the "read and write from two different fibers" test. That's a kqueue selector bug in jnr-enxio (jnr/jnr-enxio#50), and the test passes on Linux.

@headius

headius commented Oct 28, 2026

Copy link
Copy Markdown

Very exciting progress!

@headius

headius commented Oct 28, 2026

Copy link
Copy Markdown

FYI the jnr-enxio fix is merged and will be released and incorporated into 10.0.8.0 and 10.1.3.0 coming this week or early next.

This branch has not been deployed

No deployments
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.

4 participants