Killing jruby

Hello,

When I use exec “jruby my_update_prog.rb” or “java -jar jruby-complete
my_update_prog.rb” from another jruby program the java “parent”
process is not kill until the end of the second ( I dit my test on my
vista computer)…
It is a big problem since the first java process hold the files, and
my second program cannot delete it…

I thought that using exec kill the current java process…
(I also noticed that using exec “jruby prog.r” do not create another
java process whereas using exec “java …” create another…, what is
weard is that the first java process wait the end of the second to die
??)

How to solve this problem…

thanks

arnaud


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Fri, Feb 20, 2009 at 5:06 AM, Arnaud G. [email protected]
wrote:

(I also noticed that using exec “jruby prog.r” do not create another
java process whereas using exec “java …” create another…, what is
weard is that the first java process wait the end of the second to die
??)

How to solve this problem…

I’m not sure there’s a straightforward answer to this problem. #exec
is one of the corner cases for JRuby where, due to the restrictions of
the JVM, we cannot emulate the behavior of MatzRuby. We have similar
problems with #fork and thus popular gems like daemonize don’t
currently function.

I’m afraid I don’t have any suggestion other than reworking your code
around this restriction. Maybe someone else has ideas.

/Nick


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Arnaud G. wrote:

Hello,

When I use exec “jruby my_update_prog.rb” or “java -jar jruby-complete
my_update_prog.rb” from another jruby program the java “parent”
process is not kill until the end of the second ( I dit my test on my
vista computer)…
It is a big problem since the first java process hold the files, and
my second program cannot delete it…

Because we can’t simply exec to replace the current process (does exec
even do that on windows?) we simulate that behavior by waiting for the
subprocess to die and then quickly bailing out of the parent process. I
think we’re open to suggestions here on how to improve that.

I thought that using exec kill the current java process…
(I also noticed that using exec “jruby prog.r” do not create another
java process whereas using exec “java …” create another…, what is
weard is that the first java process wait the end of the second to die
??)

Because a lot of Ruby scripts launch subprocesses, and because JRuby
takes a bit more time to startup than C Ruby, at one point we added
behavior to allow running some of those subprocesses in the same JVM.
Basically, we detect if you’re calling “jruby” or “ruby” in the parent
process and just spin up another jruby instance in the same JVM.

You can disable this behavior by passing -J-Djruby.launch.inproc=true at
jruby command line. Maybe that will help you?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email