Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
JRuby automatically reaps child pids #2684
it seems like jruby automatically reaps child pids. This is different from MRI.
The following script demonstrates this.
pid = Process.spawn 'cat' # waits forever Process.kill 15, pid Process.wait pid puts 'all is good'
When run with MRI I get:
When I run it with jruby I get:
This is not always the case, sometimes I get:
I am running the following versions:
I am guessing that either jruby or the jvm automatically reaps it's children. When I get the error, it's when the child was reaped before I could call
Yeah, on 9k this should act like MRI because we're using real native process logic which will require you to waitpid on your own. In JRuby 1.7, however, we're using the JDK's process logic, and that logic does indeed immediately do its own waitpid on the child, so it can provide a thread that blocks until the child has completed (similar to MRI's Process.detach but ALL THE TIME).
There won't be an easy way to fix this in 1.7 due to the JDK, but we can mark this fixed in 9k.