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

Stdlib jopenssl/load is Broken on Java 9 #4915

Closed
original-brownbear opened this issue Dec 28, 2017 · 6 comments
Closed

Stdlib jopenssl/load is Broken on Java 9 #4915

original-brownbear opened this issue Dec 28, 2017 · 6 comments

Comments

@original-brownbear
Copy link
Contributor

It seems stdlib's jopenssl isn't fully fixed with java 9 yet.
It breaks when I try to manually include stdlib rubygems which then pulls it in transitively.

Script:

require "rubygems/commands/install_command"

Error:

➜  jopenssl-repro JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home ruby repro.rb
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jruby.ext.zlib.RubyZlib to field java.util.zip.CRC32.crc
WARNING: Please consider reporting this to the maintainers of org.jruby.ext.zlib.RubyZlib
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
LoadError: load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 1
  require at org/jruby/RubyKernel.java:955
  require at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
   <main> at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/openssl.rb:1
  require at org/jruby/RubyKernel.java:955
   (root) at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
   <main> at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
  require at org/jruby/RubyKernel.java:955
   (root) at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/security.rb:12
   <main> at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
  require at org/jruby/RubyKernel.java:955
  require at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
   <main> at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/package.rb:44
  require at org/jruby/RubyKernel.java:955
   (root) at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:1
   <main> at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55
  require at org/jruby/RubyKernel.java:955
   (root) at /Users/brownbear/.rvm/rubies/jruby-9.1.15.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:4
   <main> at repro.rb:1
➜  jopenssl-repro JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home ruby -v             
jruby 9.1.15.0 (2.3.3) 2017-12-07 929fde8 Java HotSpot(TM) 64-Bit Server VM 9+181 on 9+181 +jit [darwin-x86_64]
@original-brownbear
Copy link
Contributor Author

@headius ping :) Am I doing something wrong here or is there a remaining bug? Thanks!

@kares
Copy link
Member

kares commented Jan 19, 2018

its a 'known' (duplicate) issue and has been fixed on jossl (master): jruby/jruby-openssl#142

... unfortunately we've run into issues with certificates (just around trying to release jruby-openssl 0.10.0) #4802 which are now blocking the new release, there's some attempts to resolve them but I am not sure at this point whether we understand what's causing them in the first place (I certainly do not).
we need to put in resources to investigate the issues, if you're able to help please take a stub.

@kares kares added this to the Invalid or Duplicate milestone Jan 19, 2018
@original-brownbear
Copy link
Contributor Author

@kares ah thanks for the link! This is starting to become somewhat of a blocker for us so I'll do my best to track this down (likely today) :)
Closing here the.

@skull-squadron
Copy link

This is still an issue on a completely stock install of JRuby 9.1.17.0 + JDK 10.

$ jruby -S gem install bundler  --backtrace --debug 2>&1 | pbcopy
NOTE:  Debugging mode prints all exceptions even when rescued
java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
	at java.lang.String.checkBoundsBeginEnd(java/lang/String.java:3107)
	at java.lang.String.substring(java/lang/String.java:1873)
	at org.jruby.ext.openssl.OpenSSL.javaVersion6(org/jruby/ext/openssl/OpenSSL.java:263)
	at org.jruby.ext.openssl.Random.createHolderImpl(org/jruby/ext/openssl/Random.java:61)
	at org.jruby.ext.openssl.Random.createRandom(org/jruby/ext/openssl/Random.java:277)
	at org.jruby.ext.openssl.OpenSSL.createOpenSSL(org/jruby/ext/openssl/OpenSSL.java:78)
	at org.jruby.ext.openssl.OpenSSL.load(org/jruby/ext/openssl/OpenSSL.java:53)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:564)
	at org.jruby.javasupport.JavaMethod.invokeDirectWithExceptionHandling(org/jruby/javasupport/JavaMethod.java:453)
	at org.jruby.javasupport.JavaMethod.invokeStaticDirect(org/jruby/javasupport/JavaMethod.java:365)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/jopenssl/load.rb:26)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/openssl.rb:1)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/openssl.rb:1)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/security.rb:1)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/security.rb:12)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/package.rb:1)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.requireCommon(org/jruby/RubyKernel.java:963)
	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956)
	at org.jruby.RubyKernel$INVOKER$s$1$0$require19.call(org/jruby/RubyKernel$INVOKER$s$1$0$require19.gen)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.invokeOther27:gem_original_require(opt/rubies/jruby_minus_9_dot_1_dot_17_dot_0/lib/ruby/stdlib/rubygems/core_ext//opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at opt.rubies.jruby_minus_9_dot_1_dot_17_dot_0.lib.ruby.stdlib.rubygems.core_ext.kernel_require.require(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/package.rb:44)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:1)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:4)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:1)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:4)
	at RUBY.(root)(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:1)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:205)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:842)
	at org.jruby.Ruby.loadFile(org/jruby/Ruby.java:2903)
	at org.jruby.RubyKernel.loadCommon(org/jruby/RubyKernel.java:982)
	at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:974)
	at org.jruby.RubyKernel$INVOKER$s$0$1$load19.call(org/jruby/RubyKernel$INVOKER$s$0$1$load19.gen)
	at RUBY.<main>(/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:125)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:847)
	at org.jruby.Ruby.runInterpreter(org/jruby/Ruby.java:851)
	at org.jruby.Ruby.runNormally(org/jruby/Ruby.java:754)
	at org.jruby.Ruby.runNormally(org/jruby/Ruby.java:767)
	at org.jruby.Ruby.runFromMain(org/jruby/Ruby.java:580)
	at org.jruby.Main.doRunFromMain(org/jruby/Main.java:417)
	at org.jruby.Main.internalRun(org/jruby/Main.java:305)
	at org.jruby.Main.run(org/jruby/Main.java:232)
	at org.jruby.Main.main(org/jruby/Main.java:204)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(jdk/internal/reflect/NativeMethodAccessorImpl.java:62)
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(jdk/internal/reflect/DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:564)
	at org.flatland.drip.Main.invoke(org/flatland/drip/Main.java:117)
	at org.flatland.drip.Main.start(org/flatland/drip/Main.java:88)
	at org.flatland.drip.Main.main(org/flatland/drip/Main.java:64)
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
Exception `LoadError' at org/jruby/RubyKernel.java:956 - load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
ERROR:  Loading command: install (LoadError)
	load error: jopenssl/load -- java.lang.StringIndexOutOfBoundsException: begin 0, end 3, length 2
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/openssl.rb:1:in `<main>'
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/security.rb:1:in `<main>'
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/security.rb:12:in `<main>'
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/package.rb:1:in `<main>'
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/package.rb:44:in `<main>'
	org/jruby/RubyKernel.java:956:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55:in `require'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:1:in `(root)'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/dependency_installer.rb:4:in `(root)'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:1:in `(root)'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/commands/install_command.rb:4:in `(root)'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:1:in `(root)'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:205:in `load_and_instantiate'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:125:in `<main>'
	org/jruby/RubyKernel.java:974:in `load'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:183:in `<main>'
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:169:in `process_args'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/command_manager.rb:139:in `run'
	/opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/gem_runner.rb:55:in `run'
	/opt/rubies/jruby-9.1.17.0/bin/jgem:21:in `<main>'
	org/jruby/RubyKernel.java:974:in `load'
	/opt/rubies/jruby-9.1.17.0/bin/gem:1:in `<main>'
Exception `Gem::SystemExitException' at /opt/rubies/jruby-9.1.17.0/lib/ruby/stdlib/rubygems/user_interaction.rb:392 - Exiting RubyGems with exit_code 1

@headius
Copy link
Member

headius commented Jul 18, 2020

Please open a new issue if this is still a problem on JRuby 9.2.12.0.

@skull-squadron
Copy link

I don't use Ruby or JRuby anymore. 😆

@kares kares added the openssl label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants