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

Add opens for java.io and java.nio.channels to improve compat. #5414

Merged
merged 1 commit into from Nov 6, 2018

Conversation

Projects
None yet
1 participant
@headius
Copy link
Member

headius commented Nov 5, 2018

These packages are reflected against so heavily and for so many
low-level Ruby compatibility features that we're opening them up
for now. This was forced because we load some extensions through
a URLClassLoader, and it appears that URLClassLoader-ed libraries
get stricter treatment when it comes to illegal accesess.

The following error resulted from Puma without the java.io opens:

=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run `rails server -h` for more startup options
Exiting
LoadError: load error: puma/java_io_buffer -- java.lang.reflect.InaccessibleObjectException: Unable to make field protected byte[] java.io.ByteArrayOutputStream.buf accessible: module java.base does not "opens java.io" to module org.jruby.dist
          require at org/jruby/RubyKernel.java:976
          require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287
  load_dependency at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253
          require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287
           <main> at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/puma-3.12.0-java/lib/puma/io_buffer.rb:4
Add opens for java.io and java.nio.channels to improve compat.
These packages are reflected against so heavily and for so many
low-level Ruby compatibility features that we're opening them up
for now. This was forced because we load some extensions through
a URLClassLoader, and it appears that URLClassLoader-ed libraries
get stricter treatment when it comes to illegal accesess.

The following error resulted from Puma without the java.io opens:

```
=> Booting Puma
=> Rails 5.2.1 application starting in development
=> Run `rails server -h` for more startup options
Exiting
LoadError: load error: puma/java_io_buffer -- java.lang.reflect.InaccessibleObjectException: Unable to make field protected byte[] java.io.ByteArrayOutputStream.buf accessible: module java.base does not "opens java.io" to module org.jruby.dist
          require at org/jruby/RubyKernel.java:976
          require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287
  load_dependency at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253
          require at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287
           <main> at /Users/headius/projects/jruby/lib/ruby/gems/shared/gems/puma-3.12.0-java/lib/puma/io_buffer.rb:4
```

@headius headius added this to the JRuby 9.2.1.0 milestone Nov 5, 2018

@headius headius merged commit 8da2745 into jruby:master Nov 6, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@headius headius deleted the headius:add_io_opens branch Nov 6, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.