Visitar URL original
Allow using vthreads for all Ruby threads by headius · Pull Request #9789 · jruby/jruby · GitHub
Skip to content

Allow using vthreads for all Ruby threads - #9789

Draft
headius wants to merge 2 commits into
jruby:masterfrom
headius:all_virtual_threads
Draft

headius wants to merge 2 commits into
jruby:masterfrom
headius:all_virtual_threads

Conversation

@headius

@headius headius commented Oct 9, 2026

Copy link
Copy Markdown
Member

Ruby threads have been normal native threads up to now. This patch allows opting into using virtual threads for Ruby threads, in a model closer to m:n threading.

New property: jruby.thread.vthread=(true/*false)

Draft for testing with jruby.thread.vthread=true; it should probably be false for upcoming releases and users can opt in.

@headius headius added this to the JRuby 10.1.3.0 milestone Oct 9, 2026
@headius
headius marked this pull request as draft October 9, 2026 01:06
@headius
headius force-pushed the all_virtual_threads branch from f8ba86f to 69a6490 Compare October 9, 2026 01:11
@headius

headius commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

Surprisingly, making all threads be vthreads did not break a single test.

@headius
headius force-pushed the all_virtual_threads branch from 69a6490 to de85fd4 Compare October 9, 2026 02:02
@headius

headius commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

I have switched the feature off for now and it can be safely merged any time. We will want to do more experimentation, and perhaps add a JRuby-specific enhancement to allow opting-in for specific threads (e.g. Thread.new(virtual: true)

@headius
headius marked this pull request as ready for review October 9, 2026 02:04
Ruby threads have been normal native threads up to now. This patch
allows opting into using virtual threads for Ruby threads, in a
model closer to m:n threading.

New property: jruby.thread.vthread=(true/*false)
@headius
headius force-pushed the all_virtual_threads branch from de85fd4 to 51a13a0 Compare October 9, 2026 02:10
@headius

headius commented Oct 9, 2026

Copy link
Copy Markdown
Member Author

I had the logic flipped, actually. Most builds fail with all threads virtual because virtual threads do not appear to be setting up the RubyThreadGroup correctly. I've flipped it back on with corrected logic to try to get things green.

@headius
headius marked this pull request as draft October 9, 2026 02:10
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.

1 participant