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

StackOverflowError regarding RubyGems, require(), rubygems/defaults/jruby.rb, and jruby/util.rb

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.6
    • Fix Version/s: JRuby 1.6.7
    • Component/s: None
    • Labels:
      None
    • Environment:
      TorqueBox!
    • Number of attachments :
      0

      Description

      Per IRC conversation and logs here:

      https://raw.github.com/gist/1713489/e5ccdae1abe3a0d8cd4bc1529241500b779dd5b9/server.log

      StackOverflowError within TorqueBox due to interaction between RubyGems and something and something and possibly something else.

      Solution seems to be moving an inside-the-method require of jruby/util.rb to the top of rubygems/defaults/jruby.rb

        Issue Links

          Activity

          Hide
          bob mcwhirter added a comment -

          To be clear, the fix is Headius's. I just wrote it down here for posterity. Chuckles gets the credit.

          Show
          bob mcwhirter added a comment - To be clear, the fix is Headius's. I just wrote it down here for posterity. Chuckles gets the credit.
          Hide
          Hiroshi Nakamura added a comment -

          Fixed at [jruby-1_6 62f395be] and [master dfbae1ca].

          commit 62f395be176de1f412ce5a81fcc094076d800ca1
          Author: Hiroshi Nakamura <nahi@ruby-lang.org>
          Date:   Thu Feb 2 12:12:45 2012 +0900
          
              JRUBY-6400, 6407: Fix StackOverflowError under some Gem activation situation
              
              RubyGems seems to expect that we don't invoke custom_require while Gem
              spec scanning.  Our JRuby extension in rubygems/defaults/jruby did
              'require "jruby/util"' while Gem scanning and it caused circular
              custom_require invocation.
              
              Since jruby/util is a small, non invasive library (it defines JRuby
              module, JRuby::Util module and some methods of JRuby::Util), this commit
              simply moved the 'require "jruby/util"' line at the top of
              rubygems/defaults/jruby.rb for loading the library at RubyGems
              initialization time.
          
          diff --git a/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb b/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb
          index 20391a0..fdcd019 100644
          --- a/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb
          +++ b/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb
          @@ -1,5 +1,6 @@
           require 'rubygems/config_file'
           require 'rbconfig'
          +require 'jruby/util'
           
           module Gem
           
          @@ -69,7 +70,6 @@ class Gem::Specification
               end
           
               def spec_directories_from_classpath
          -      require 'jruby/util'
                 stuff = JRuby::Util.classloader_resources("specifications")
               end
             end
          
          Show
          Hiroshi Nakamura added a comment - Fixed at [jruby-1_6 62f395be] and [master dfbae1ca] . commit 62f395be176de1f412ce5a81fcc094076d800ca1 Author: Hiroshi Nakamura <nahi@ruby-lang.org> Date: Thu Feb 2 12:12:45 2012 +0900 JRUBY-6400, 6407: Fix StackOverflowError under some Gem activation situation RubyGems seems to expect that we don't invoke custom_require while Gem spec scanning. Our JRuby extension in rubygems/defaults/jruby did 'require "jruby/util"' while Gem scanning and it caused circular custom_require invocation. Since jruby/util is a small, non invasive library (it defines JRuby module, JRuby::Util module and some methods of JRuby::Util), this commit simply moved the 'require "jruby/util"' line at the top of rubygems/defaults/jruby.rb for loading the library at RubyGems initialization time. diff --git a/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb b/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb index 20391a0..fdcd019 100644 --- a/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb +++ b/lib/ruby/site_ruby/1.8/rubygems/defaults/jruby.rb @@ -1,5 +1,6 @@ require 'rubygems/config_file' require 'rbconfig' +require 'jruby/util' module Gem @@ -69,7 +70,6 @@ class Gem::Specification end def spec_directories_from_classpath - require 'jruby/util' stuff = JRuby::Util.classloader_resources("specifications") end end
          Hide
          Hiroshi Nakamura added a comment -
          > To be clear, the fix is Headius's.
          

          Thanks for reporting, and thanks Charles for the right fix. I'd wait him to back from conferences

          Hope this fix solves Heiko's problem, too.

          Show
          Hiroshi Nakamura added a comment - > To be clear, the fix is Headius's. Thanks for reporting, and thanks Charles for the right fix. I'd wait him to back from conferences Hope this fix solves Heiko's problem, too.
          Hide
          Heiko Seebach added a comment -

          Hi,

          yes it does Thanks for that. Do you plan a 1.6.6.1 release or so?

          thanks, Heiko

          Show
          Heiko Seebach added a comment - Hi, yes it does Thanks for that. Do you plan a 1.6.6.1 release or so? thanks, Heiko
          Hide
          Charles Oliver Nutter added a comment - - edited

          Nahi: your fix is just fine. It will be the first time loading a standard library has caused the "JRuby" namespace to come to life, but I don't think we can avoid that anymore. We need the functionality it contains, so we'll just go ahead and load it.

          Show
          Charles Oliver Nutter added a comment - - edited Nahi: your fix is just fine. It will be the first time loading a standard library has caused the "JRuby" namespace to come to life, but I don't think we can avoid that anymore. We need the functionality it contains, so we'll just go ahead and load it.

            People

            • Assignee:
              Hiroshi Nakamura
              Reporter:
              bob mcwhirter
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: