New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reenable Java implementations #717
Comments
cc @enebo @headius could JRuby's thread kill and other operations be made compatible with java interrupt mechanism to unblock Ruby threads blocked by Java blocking classes like CountDownLatch, Exchanger, etc. So far I think this needs a fix from JRuby side, the Thread's kill, wakup etc. methods would need to interrupt. |
JRuby can't violate anything about Java's threads, so we won't forcibly kill a target thread. We do have mechanisms to allow you to block with a wakeup mechanism, however, which is how we do locking and sleeps and selects interruptibly. See how sleep works in JRuby for an example. |
yeah, I use the JRuby's interruptible in https://github.com/ruby-concurrency/concurrent-ruby/blob/master/ext/com/concurrent_ruby/ext/SynchronizationLibrary.java#L244 however that does not work afaik with |
@pitr-ch I believe you want to use this method: https://github.com/jruby/jruby/blob/1e235478afd39f5b62dd26dd3b8677fbc7582011/core/src/main/java/org/jruby/RubyThread.java#L1530 RubyThread.executeTask allows you to register an "unblocker" implementation that can be used to do that thread interrupt. I use the same mechanism here: https://github.com/jruby/jruby/blob/807900a0478fd4d9a5509eb4ad1172a1a89a2c1e/core/src/main/java/org/jruby/ext/thread/Queue.java#L581-L588 |
Ah great that looks simpler that I thought. I may be able to fix this without rollbacking the Java implementations for the upcoming patch release. Thanks. |
@pitr-ch hey is there still a Fixnum type check in concurrent-ruby? We have a 2.5 implementation now and we see:
(Sorry for not just PRing or opening an issue :) ). |
@enebo thanks, fixed |
Fix #717: Reenable java implementations, fix global IO executor on JRuby, bunch of other bug fixes
All the Java blocking abstraction implementations had to be rolled back because the java threading is not compatible with ruby threading. E.g. a thread blocked by java CountDownLatch implementation cannot be killed from Ruby.
Note: Anything that uses Concurrent::Synchronization layer is fine since it's hooks into JRuby's internal mechanism for threads, but naked Java implementations are a problem.
Disabled in a6fc08f, 1e51d2c
The text was updated successfully, but these errors were encountered: