jruby doesn't fork the backtick command when the command is jruby
-----------------------------------------------------------------

                 Key: JRUBY-5681
                 URL: http://jira.codehaus.org/browse/JRUBY-5681
             Project: JRuby
          Issue Type: Bug
    Affects Versions: JRuby 1.6
         Environment: JRuby 1.6 on Windows
            Reporter: Jeff Solomon
            Assignee: Thomas E Enebo
         Attachments: bar.rb, foo.rb

Attached are two files, foo.rb and bar.rb. Copy these files to the jruby bin 
directory and type:

  jruby.exe foo.rb

or (if not on Windows):

  jruby foo.rb

Then bring up procexp (or top) and watch to see if any subprocess jruby is 
created.

I see that no additional jruby process is created. MRI c ruby does not have 
this behavior. It will create two ruby processes.

I assume this is an optimization but it's a bad one. If I wanted to simply run 
another ruby script from my current ruby process, I would load or require it 
and then call it. However, this optimization is playing havoc with jruby's idea 
of what modules it has loaded. Our jruby scripts load jar which themselves call 
System.loadLibrary() to load DLLs. When the jar is loaded the loadLibrary call 
should happen once and life is good. However, this "optimization" in the 
backtick logic is causing that java code to execute twice and make our original 
jruby script very unstable.

We can work around this by using IO.popen and we'll do that, however, I really 
think it breaks expectation to have backtick NOT create another process is 
every situation, including when the backtick command is another instance of 
jruby itself.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to