Skip to content
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

Crash: illegal hardware instruction when used inside Ruby Fiber #87

Open
bmulholland opened this issue May 6, 2022 · 4 comments
Open

Comments

@bmulholland
Copy link

bmulholland commented May 6, 2022

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

test.rb

require "rjb"

Fiber.new {
  Rjb.import("java.lang.String")
}.resume

% RUBYOPT=-w ruby test.rb
test.rb:4: warning: Rjb::implicit jvm loading
[1] 11701 illegal hardware instruction RUBYOPT=-w ruby test.rb

@bmulholland
Copy link
Author

bmulholland commented May 6, 2022

Alternatively:

require "rjb"

Rjb.load # ADDED

Fiber.new {
  Rjb.import("java.lang.String")
}.resume

% RUBYOPT=-w ruby test.rb
Exception in thread "main"
test.rb:6:in `import': unknown exception (RuntimeError)
from test.rb:6:in `block in <main>'

@bmulholland
Copy link
Author

If it makes a difference in choosing with of the three issues I've filed to look into first, this one is my top priority -- it's blocking me from using GraphQL Dataloader to improve the performance of my app.

@arton
Copy link
Owner

arton commented May 7, 2022

Hi bmulholland
I could reproduce the crash on x64 box. Therefore it should be fiber and rjb (jvm initialization including class load) combination.

I think it's critical issue between Ruby-Rjb-JVM and I suppose the fix is the long way travel.
I wonder if you could change your code such as
(remove 1st exapmle)

In ruby's fiber, any JVM invokation may fail. I think it's caused by fiber and jvm implementation behavior/design.
At this time, we can have no chance to use Rjb in fiber.

@bmulholland
Copy link
Author

Thanks for your investigation. We'll look into alternative approaches.

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

No branches or pull requests

2 participants