jruby / jruby

JRuby, an implementation of Ruby on the JVM
https://www.jruby.org
Other
3.78k stars 922 forks source link

require_relative fails sometimes with JRuby 1.7.22 on Win7 #3466

Closed robertpanzer closed 8 years ago

robertpanzer commented 8 years ago

We've got an issue with AsciidoctorJ with asciidoctor-diagram running on Win 7 when JRuby 1.7.22 is used. When asciidoctor-diagram is required the JRuby fails with this:

org.jruby.exceptions.RaiseException: (Errno::ENOENT) C:\Users\robert.panzer\.gradle\caches\modules-2\files-2.1\org.asciidoctor\asciidoctorj-diagram\1.3.1\2bab2cb40a6770e8943c5d944d5961d1b4a6f7e8\asciidoctorj-diagram-.3.1.jar!\gems\asciidoctor-diagram-1.3.1\lib\asciidoctor-diagram\blockdiag.rb
        at org.jruby.RubyFile.realpath(org/jruby/RubyFile.java:840)
        at RUBY.require_relative(file:/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.22/42dc9be2f706774c24ef61ec2981d05e2c79a9e2/jruby-complete-1.7.22.jar!/jruby/kernel19/kernel.rb:11)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-diagram/1.3.1/2bab2cb40a6770e8943c5d944d5961d1b4a6f7e8/asciidoctorj-diagram-1.3.1.jar!/gems/asciidoctor-diagram-1.3.1/lib/asciidoctor-diagram/blockdiag.rb:2)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.22/42dc9be2f706774c24ef61ec2981d05e2c79a9e2/jruby-complete-1.7.22.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)
        at RUBY.require(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.22/42dc9be2f706774c24ef61ec2981d05e2c79a9e2/jruby-complete-1.7.22.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54)
        at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1040)
        at RUBY.(root)(C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.asciidoctor/asciidoctorj-diagram/1.3.1/2bab2cb40a6770e8943c5d944d5961d1b4a6f7e8/asciidoctorj-diagram-1.3.1.jar!/gems/asciidoctor-diagram-1.3.1/lib/asciidoctor-diagram.rb:1)
        at RUBY.(root)(/C:/Users/robert.panzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/1.7.22/42dc9be2f706774c24ef61ec2981d05e2c79a9e2/jruby-complete-1.7.22.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1)

This error does not appear when using the JRuby 1.7.21 or below.

We opened an issue in AsciidoctorJ for that which we resolved atm by downgrading to 1.7.21: https://github.com/asciidoctor/asciidoctorj/issues/401

As there are many, many invocations of require_relative all over the Ruby code, I guess that it is not easy to reproduce this problem with a trivial test program (at least not if you don't know the reason for the error).

I created a small gradle build that reproduces the error:

repositories {
    jcenter()
}

configurations {
    run
}

dependencies {
    run 'org.asciidoctor:asciidoctorj:1.5.3.2'
    run 'org.asciidoctor:asciidoctorj-diagram:1.3.1'
    run 'org.jruby:jruby-complete:1.7.22'
}

task createTestDoc << {
    new File('test.adoc').text = '''= Test document

Test''' 
}

task runTest(type: JavaExec, dependsOn: createTestDoc) {
    classpath = configurations.run
    main = 'org.asciidoctor.cli.AsciidoctorInvoker'
    args '-r', 'asciidoctor-diagram', 'test.adoc'
}

Running gradle rT will produce the error mentioned above. Setting the jruby version to 1.7.21 will successfully render the document.

mkristian commented 8 years ago

this will be fixed with jruby-1.7.23 releasing this week.

mkristian commented 8 years ago

I backported all the patches from master to jruby-1_7 but did not test this gradle script on windows.

robertpanzer commented 8 years ago

Is it possible to get a snapshot build of 1.7.23-SNAPSHOT so that I could try that?

mkristian commented 8 years ago

https://oss.sonatype.org/content/repositories/snapshots/org/jruby/jruby-complete/

I tried to run it on my windows VM but it died while I was away from the laptop

mkristian commented 8 years ago

finally got it to work after using an VPN in the US :)

fixed.