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

JRuby master OpenSSL fails to install gems #2034

Closed
headius opened this issue Oct 9, 2014 · 5 comments
Closed

JRuby master OpenSSL fails to install gems #2034

headius opened this issue Oct 9, 2014 · 5 comments
Assignees
Labels

Comments

@headius
Copy link
Member

headius commented Oct 9, 2014

We are using jruby-openssl 0.9.5 on master. However it just recently started failing because some code tries to access ChannelDescriptor, a class removed on JRuby master.

Attempting to install a gem with a clean build produces errors like this:

Caused by:
URLClassLoader.java:372:in `run': java.lang.ClassNotFoundException: org.jruby.util.io.ChannelDescriptor
    from URLClassLoader.java:361:in `run'
    from AccessController.java:-2:in `doPrivileged'
    from URLClassLoader.java:360:in `findClass'
    from JRubyClassLoader.java:196:in `findClass'
    from ClassLoader.java:424:in `loadClass'
    from JRubyClassLoader.java:144:in `loadClass'
    from ClassLoader.java:357:in `loadClass'
    from Lookup.java:299:in `wrapJRubyNormalizedInputStream'
    from Lookup.java:246:in `loadCertificateOrCRLFile'
    from Lookup.java:435:in `call'
    from Lookup.java:411:in `call'
    from Lookup.java:123:in `control'
    from Lookup.java:92:in `loadFile'
    from Store.java:308:in `loadLocations'
    from X509Store.java:149:in `add_file'
    from X509Store$INVOKER$i$1$0$add_file.gen:-1:in `call'

If I try to use 0.9.6.dev-SNAPSHOT I get an error indicating a bug in 0.9.6:

ERROR:  Could not find a valid gem 'rspec' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - hostname "api.rubygems.org" does not match the server certificate (https://api.rubygems.org/latest_specs.4.8.gz)

JRuby master is currently broken for gem installs and anything using OpenSSL as a result.

Pinging @mkristian and @kares since they have been working on OpenSSL lately.

@headius headius added the openssl label Oct 9, 2014
@mkristian
Copy link
Member

just tried to reproduce in the jruby-openssl issue:

git pull
git clean -dfx
mvn -Pbootstrap

works for me. just a few days back I reverted to jruby-openssl version back to 0.9.5 since 0.9.6.dev-SNAPSHOT gave some errors, at a different place.

@mkristian
Copy link
Member

I misunderstood it first. but

 $ bin/gem install jbundler

Fetching: jar-dependencies-0.1.3.gem (100%)
Successfully installed jar-dependencies-0.1.3
Fetching: jbundler-0.6.4.gem (100%)
Successfully installed jbundler-0.6.4
2 gems installed

also works.

@mkristian
Copy link
Member

interesting that the command execution produces a different error using (jruby-openssl-.0.9.6.dev-SNAPSHOT) then jruby-complete:

$ java -jar maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar -S bin/jgem install jbundler
file:/
ERROR:  While executing gem ... (OpenSSL::X509::StoreError)
    loading file failed: /home/christian/projects/active/maven/jruby/maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem (No such file or directory)

which is what I have seen here jruby/jruby-openssl#11

where as using jruby-openssl-0.9.5.gem and jruby-complete matches the error with commandline execution.

@kares
Copy link
Member

kares commented Oct 10, 2014

yes ... it's been eliminated, since we talked about it jruby/jruby-openssl@f54b3bc being an issue with 9k

so the same error might as well reproduce on 0.9.5 it's just it's failing before with a CNFE ... I really hoped for a 0.9.6 release - there's like a dosen of goodies in already. there's mostly one ASN1 decoding "regression" which actually seems like a C OpenSSL "bug" but than the certificate's signature is different - it's been giving me a headache this week and I did not crack it so far so it might take a while (also some of the tests in JRuby's repo are testing non compatible behavior - I shall adress them all in a PR later that shall go in after the gem release)

@mkristian
Copy link
Member

using jruby-openssl-0.9.5.gem

java.lang.ClassNotFoundException: org.jruby.util.io.ChannelDescriptor

GEM_HOME=asd GEM_PATH=asd java -cp maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar org.jruby.Main bin/jgem install jbundler
=> jruby home: file:/home/christian/projects/active/maven/jruby/maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar!/META-INF/jruby.home

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar -Djruby.home=uri:classloader:/META-INF/jruby.home org.jruby.Main bin/jgem install jbundler

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar org.jruby.Main bin/jgem install jbundler
=> jruby home: file:/home/christian/projects/active/maven/jruby/maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar!/META-INF/jruby.home

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar -Djruby.home=. org.jruby.Main bin/jgem install jbundler

GEM_HOME=asd GEM_PATH=asd java -cp maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar -Djruby.home=. org.jruby.Main bin/jgem install jbundler

works:

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar -Djruby.home=classpath:/META-INF/jruby.home org.jruby.Main bin/jgem install jbundler

GEM_HOME=asd GEM_PATH=asd java -cp maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar -Djruby.home=classpath:/META-INF/jruby.home org.jruby.Main bin/jgem install jbundler

using jruby-openssl-0.9.6-SNAPSHOT.gem

ERROR: While executing gem ... (OpenSSL::X509::StoreError)

loading file failed: /home/christian/projects/active/maven/jruby/maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/ssl_certs/DigiCertHighAssuranceEVRootCA.pem (No such file or directory)

GEM_HOME=asd GEM_PATH=asd java -cp maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar org.jruby.Main bin/jgem install jbundler

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar org.jruby.Main bin/jgem install jbundler

java.lang.RuntimeException

at org.jruby.util.URLResource.hackyGetJRubyFile(URLResource.java:131)
at org.jruby.ext.openssl.X509Store.add_file(X509Store.java:152)
at org.jruby.ext.openssl.X509Store$INVOKER$i$1$0$add_file.call(X509Store$INVOKER$i$1$0$add_file.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:30
    ....

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar -Djruby.home=uri:classloader:/META-INF/jruby.home org.jruby.Main bin/jgem install jbundler

ERROR: Could not find a valid gem 'jbundler' (>= 0), here is why:

      Unable to download data from https://rubygems.org/ - hostname "api.rubygems.org" does not match the server certificate (https://api.rubygems.org/latest_specs.4.8.gz)

GEM_HOME=asd GEM_PATH=asd java -cp lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-9000.dev-SNAPSHOT.jar -Djruby.home=. org.jruby.Main bin/jgem install jbundler
GEM_HOME=asd GEM_PATH=asd java -cp maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar -Djruby.home=. org.jruby.Main bin/jgem install jbundler
GEM_HOME=asd GEM_PATH=asd bin/jruby bin/jgem install jbundler

conclusion

it depends on which jruby home is used what works or not. the scenario I used was basically the two jar files from jruby-jars.gem or jruby-complete or bin/jruby from filesystem.

the reason jruby.home=classpath:/META-INF/jruby.home works is that Dir globs do not work and then no pem will be found inside the jruby.home and none will be added to X509Store !!

on set of errors is related to jruby/jruby-openssl#11

the other is the mismatched hostname with certificate.

the last error with uri:classloader: is fixed by #2027

@mkristian mkristian self-assigned this Dec 5, 2014
@enebo enebo added this to the Invalid or Duplicate milestone Apr 28, 2015
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