Affects Version/s: JRuby 1.6
Fix Version/s: JRuby 1.7.0.pre1
Environment:JRuby 1.6 on Windows
Number of attachments :
Attached are two files, foo.rb and bar.rb. Copy these files to the jruby bin directory and type:
or (if not on Windows):
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.