{"action":"closed","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/2684","labels_url":"https://api.github.com/repos/jruby/jruby/issues/2684/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/2684/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/2684/events","html_url":"https://github.com/jruby/jruby/issues/2684","id":60704385,"number":2684,"title":"JRuby automatically reaps child pids","user":{"login":"beraboris","id":1874242,"avatar_url":"https://avatars.githubusercontent.com/u/1874242?v=3","gravatar_id":"","url":"https://api.github.com/users/beraboris","html_url":"https://github.com/beraboris","followers_url":"https://api.github.com/users/beraboris/followers","following_url":"https://api.github.com/users/beraboris/following{/other_user}","gists_url":"https://api.github.com/users/beraboris/gists{/gist_id}","starred_url":"https://api.github.com/users/beraboris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beraboris/subscriptions","organizations_url":"https://api.github.com/users/beraboris/orgs","repos_url":"https://api.github.com/users/beraboris/repos","events_url":"https://api.github.com/users/beraboris/events{/privacy}","received_events_url":"https://api.github.com/users/beraboris/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-11T18:13:38Z","updated_at":"2015-03-12T18:35:24Z","closed_at":"2015-03-12T18:35:24Z","body":"it seems like jruby automatically reaps child pids. This is different from MRI.\r\n\r\nThe following script demonstrates this.\r\n\r\n```ruby\r\npid = Process.spawn 'cat' # waits forever\r\nProcess.kill 15, pid\r\nProcess.wait pid\r\n\r\nputs 'all is good'\r\n```\r\n\r\nWhen run with MRI I get:\r\n\r\n```\r\n$ ruby test.rb\r\nall is good\r\n```\r\n\r\nWhen I run it with jruby I get:\r\n\r\n```\r\n$ jruby test.rb\r\nPicked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd\r\nErrno::ECHILD: No child processes - No child processes\r\n  waitpid at org/jruby/RubyProcess.java:536\r\n     wait at org/jruby/RubyProcess.java:563\r\n     wait at org/jruby/RubyProcess.java:558\r\n   (root) at test.rb:3\r\n```\r\n\r\nThis is not always the case, sometimes I get:\r\n\r\n```\r\n$ jruby test.rb\r\nPicked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd\r\nall is good\r\n```\r\n\r\nI am running the following versions:\r\n\r\n```\r\n$ ruby --version\r\nruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]\r\n$ jruby --version\r\nPicked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=lcd\r\njruby 1.7.18 (1.9.3p551) 2014-12-22 625381c on Java HotSpot(TM) 64-Bit Server VM 1.8.0_31-b13 +jit [linux-amd64]\r\n```\r\n\r\nI 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 `Process#kill`. When I don't get the error, it's because I  managed to call `Process#wait` before the child process was automatically reaped."}}