Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.7, JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I'm using JRuby 1.6.7 and Capistrano for orchestrating the deployments of a bunch of Ruby and Java projects. I received an ArrayIndexOutOfBoundsException when trying to start up 3 separate threads that would use IO.popen to execute some commands in parallel. It looks like the ShellLauncher.getCurrentEnv method is expecting that the global ENV variable won't change size while it copies it to a Java String array. (http://grepcode.com/file/repo1.maven.org/maven2/org.jruby/jruby-core/1.6.7/org/jruby/util/ShellLauncher.java#219) I think Bundler is changing the ENV hash in my particular case. The ShellLauncher code shouldn't make this particular assumption. See this gist: https://gist.github.com/2398538 for a contrived example that reproduces the bug.

        Issue Links

          Activity

          Hide
          Hiro Asari added a comment -

          Confirmed on master.

          Show
          Hiro Asari added a comment - Confirmed on master.
          Hide
          Charles Oliver Nutter added a comment -
          commit 5032adeb443cf3116b05d97e99143ff91ded7067
          Author: Charles Oliver Nutter <headius@headius.com>
          Date:   Tue May 15 23:27:42 2012 -0500
          
              Fix JRUBY-6603
              
              To avoid attempting to read the ENV hash while it might be updated
              elsewhere, I added a dup call. This is not 100% perfect if dup is
              not threadsafe (unsure) but it was able to pass the given
              contrived example.
          
          Show
          Charles Oliver Nutter added a comment - commit 5032adeb443cf3116b05d97e99143ff91ded7067 Author: Charles Oliver Nutter <headius@headius.com> Date: Tue May 15 23:27:42 2012 -0500 Fix JRUBY-6603 To avoid attempting to read the ENV hash while it might be updated elsewhere, I added a dup call. This is not 100% perfect if dup is not threadsafe (unsure) but it was able to pass the given contrived example.
          Hide
          Charles Oliver Nutter added a comment -

          I had to modify a test for tracing logic because dup causes a call to initialize copy. We may want a better solution for this, but it's fine for now.

          Show
          Charles Oliver Nutter added a comment - I had to modify a test for tracing logic because dup causes a call to initialize copy. We may want a better solution for this, but it's fine for now.

            People

            • Assignee:
              Charles Oliver Nutter
              Reporter:
              Jason Gilman
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: