JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-6521

Invokedynamic leads to unusual errors in RubyGems dependency logic

    Details

    • Type: Bug Bug
    • Status: Reopened Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JRuby 1.7.0.pre1
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-03-03 ed5390c) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_04-ea) [darwin-amd64-java]
    • Number of attachments :
      0

      Description

      Tried running one of my projects with JRuby, works well without nailgun, getting lots of weird errors when using nailgun.

      I'm using --1.9

      $ script/console
      Invalid gemspec in [/Users/msch/.rvm/gems/jruby-head/specifications/tilt-1.3.3.gemspec]: Valid types are [:development, :runtime], 
      /Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler.rb:250 warning: shadowing outer local variable - path
      org.jruby.exceptions.RaiseException: (ArgumentError) Valid types are [:development, :runtime], 
      	at Gem::Dependency.initialize(/Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/dependency.rb:45)
      	at RUBY.gem(/Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:1208)
      	at RUBY.(root)(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler/psyched_yaml.rb:3)
      	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:976)
      	at RUBY.require(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler/psyched_yaml.rb:36)
      	at RUBY.(root)(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler.rb:4)
      	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:976)
      	at RUBY.require(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler.rb:36)
      	at RUBY.(root)(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler/setup.rb:4)
      	at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:976)
      	at RUBY.require(/Users/msch/.rvm/gems/jruby-head/gems/bundler-1.1.rc.7/lib/bundler/setup.rb:36)
      
      $ gem -version
      1.8.15
      $ gem --version
      TypeError: assigning non-exception to $!
                load at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:548
                _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:269
                each at org/jruby/RubyArray.java:1611
                _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:268
        reverse_each at org/jruby/RubyArray.java:1691
                _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:267
                each at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:409
                 map at org/jruby/RubyEnumerable.java:705
          find_files at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:480
        load_plugins at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:1085
              (root) at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:86
             require at org/jruby/RubyKernel.java:976
             require at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:36
              (root) at /Users/msch/.rvm/rubies/jruby-head/bin/gem:13
      $ bundle install
      Using i18n (0.6.0) 
      Using multi_json (1.1.0) 
      Using activesupport (3.2.2) from https://github.com/rails/rails.git (at 3-2-stable) 
      Using builder (3.0.0) 
      Using activemodel (3.2.2) from https://github.com/rails/rails.git (at 3-2-stable) 
      Using arel (3.0.2) 
      Using tzinfo (0.3.31) 
      Using activerecord (3.2.2) from https://github.com/rails/rails.git (at 3-2-stable) 
      Java::JavaLang::NoClassDefFoundError: org/jruby/runtime/ThreadContext
      An error occured while installing activerecord (3.2.2), and Bundler cannot continue.
      Make sure that `gem install activerecord -v '3.2.2'` succeeds before bundling.
      

      Sometimes a command works once but not a second time after restarting the ng server.

        Activity

        Hide
        Hiro Asari added a comment -

        What, exactly, are you doing? Please indicate what steps you took to get to this state. Also, try with Java 6.

        Show
        Hiro Asari added a comment - What, exactly, are you doing? Please indicate what steps you took to get to this state. Also, try with Java 6.
        Hide
        Martin Schürrer added a comment -

        Ok, just tried with Java 6 and it worked. Here are the steps that lead to the bug for me:

        $ jruby --ng-server &
        NGServer started on all interfaces, port 2113.
        
        $ export JRUBY_OPTS='--ng'
        
        $ gem list
        ... list of gems...
        
        $ gem list
        TypeError: assigning non-exception to $!
                  load at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:549
                  _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:269
                  each at org/jruby/RubyArray.java:1611
                  _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:268
                  each at org/jruby/RubyArray.java:1611
                  _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:267
                  each at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:410
                   map at org/jruby/RubyEnumerable.java:705
            find_files at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:482
          load_plugins at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:1087
                (root) at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:86
               require at org/jruby/RubyKernel.java:976
               require at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:36
                (root) at /Users/msch/.rvm/rubies/jruby-head/bin/gem:9
        
        Show
        Martin Schürrer added a comment - Ok, just tried with Java 6 and it worked. Here are the steps that lead to the bug for me: $ jruby --ng-server & NGServer started on all interfaces, port 2113. $ export JRUBY_OPTS='--ng' $ gem list ... list of gems... $ gem list TypeError: assigning non-exception to $! load at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:549 _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:269 each at org/jruby/RubyArray.java:1611 _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:268 each at org/jruby/RubyArray.java:1611 _all at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:267 each at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/specification.rb:410 map at org/jruby/RubyEnumerable.java:705 find_files at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:482 load_plugins at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems.rb:1087 (root) at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:86 require at org/jruby/RubyKernel.java:976 require at /Users/msch/.rvm/rubies/jruby-head/lib/ruby/shared/rubygems/gem_runner.rb:36 (root) at /Users/msch/.rvm/rubies/jruby-head/bin/gem:9
        Hide
        Charles Oliver Nutter added a comment -

        Appears to be working fine now. I would wager that it was a bug in our invokedynamic support causing the error, or bugs in invokedynamic itself. In any case, invokedynamic is temporarily disabled in pre2, but it passes all tests on newer JVMs that don't have the bugs of the old one. Marking as fixed.

        Show
        Charles Oliver Nutter added a comment - Appears to be working fine now. I would wager that it was a bug in our invokedynamic support causing the error, or bugs in invokedynamic itself. In any case, invokedynamic is temporarily disabled in pre2, but it passes all tests on newer JVMs that don't have the bugs of the old one. Marking as fixed.
        Hide
        Tobias Schlottke added a comment - - edited

        I tried my application with 1.7.0, java 8 + indy and get this exception:

        application initialization failed: Valid types are [:development, :runtime], 
        	from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/dependency.rb:45:in `initialize'
        	from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems.rb:1231:in `gem'
        	from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler/psyched_yaml.rb:3:in `(root)'
        	from org/jruby/RubyKernel.java:1019:in `require'
        	from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'
        	from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler.rb:1:in `(root)'
        	from org/jruby/RubyKernel.java:1019:in `require'
        	from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:36:in `require'
        	from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler.rb:5:in `(root)'
        	from org/jruby/RubyKernel.java:1019:in `require'
        	from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler/setup.rb:1:in `(root)'m
        

        This is my JVM:

        java version "1.8.0-ea"
        Java(TM) SE Runtime Environment (build 1.8.0-ea-b61)
        Java HotSpot(TM) 64-Bit Server VM (build 25.0-b05, mixed mod
        
        
        Show
        Tobias Schlottke added a comment - - edited I tried my application with 1.7.0, java 8 + indy and get this exception: application initialization failed: Valid types are [:development, :runtime], from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/dependency.rb:45:in `initialize' from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems.rb:1231:in `gem' from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler/psyched_yaml.rb:3:in `(root)' from org/jruby/RubyKernel.java:1019:in `require' from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:36:in `require' from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler.rb:1:in `(root)' from org/jruby/RubyKernel.java:1019:in `require' from /usr/local/rvm/rubies/jruby-1.7.0/lib/ruby/shared/rubygems/custom_require.rb:36:in `require' from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler.rb:5:in `(root)' from org/jruby/RubyKernel.java:1019:in `require' from /usr/local/rvm/gems/jruby-1.7.0@global/gems/bundler-1.2.1/lib/bundler/setup.rb:1:in `(root)'m This is my JVM: java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b61) Java HotSpot(TM) 64-Bit Server VM (build 25.0-b05, mixed mod
        Hide
        Charles Oliver Nutter added a comment -

        Reopening because of new reports with JRuby 1.7 on Java 8.

        Show
        Charles Oliver Nutter added a comment - Reopening because of new reports with JRuby 1.7 on Java 8.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Martin Schürrer
          • Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated: