{"action":"created","issue":{"url":"https://api.github.com/repos/net-ssh/net-ssh/issues/436","repository_url":"https://api.github.com/repos/net-ssh/net-ssh","labels_url":"https://api.github.com/repos/net-ssh/net-ssh/issues/436/labels{/name}","comments_url":"https://api.github.com/repos/net-ssh/net-ssh/issues/436/comments","events_url":"https://api.github.com/repos/net-ssh/net-ssh/issues/436/events","html_url":"https://github.com/net-ssh/net-ssh/pull/436","id":182250423,"number":436,"title":"detach proxycommand processes to avoid them becoming zombies","user":{"login":"willbryant","id":12062,"avatar_url":"https://avatars.githubusercontent.com/u/12062?v=3","gravatar_id":"","url":"https://api.github.com/users/willbryant","html_url":"https://github.com/willbryant","followers_url":"https://api.github.com/users/willbryant/followers","following_url":"https://api.github.com/users/willbryant/following{/other_user}","gists_url":"https://api.github.com/users/willbryant/gists{/gist_id}","starred_url":"https://api.github.com/users/willbryant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbryant/subscriptions","organizations_url":"https://api.github.com/users/willbryant/orgs","repos_url":"https://api.github.com/users/willbryant/repos","events_url":"https://api.github.com/users/willbryant/events{/privacy}","received_events_url":"https://api.github.com/users/willbryant/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-10-11T12:26:55Z","updated_at":"2016-10-16T08:02:34Z","closed_at":"2016-10-15T16:19:55Z","pull_request":{"url":"https://api.github.com/repos/net-ssh/net-ssh/pulls/436","html_url":"https://github.com/net-ssh/net-ssh/pull/436","diff_url":"https://github.com/net-ssh/net-ssh/pull/436.diff","patch_url":"https://github.com/net-ssh/net-ssh/pull/436.patch"},"body":"In Unix/Linux/etc, you must call one of the wait methods (eg. Process.wait) to retrieve the exit code of a terminated process.  Until you do this, the process sits in the process table as a zombie process, and over time as a number of connections get made and closed through a proxycommand-style proxy they pile up like this:\r\n\r\n$ pstree|grep -F '(ssh)'|wc -l\r\n      12\r\n$ pstree|grep -F '(ssh)'|wc -l\r\n      15\r\n$ pstree|grep -F '(ssh)'|wc -l\r\n      28\r\n\r\nSince we have no interest in the exit code of the proxycommand process (we have never checked it before), we can detach the process instead, so that it doesn't becomes a zombie (technically the PID 1 process waits for it instead).\r\n\r\nWe still have open IO handles to the process, so there's no change to how long that process lives."},"comment":{"url":"https://api.github.com/repos/net-ssh/net-ssh/issues/comments/254033326","html_url":"https://github.com/net-ssh/net-ssh/pull/436#issuecomment-254033326","issue_url":"https://api.github.com/repos/net-ssh/net-ssh/issues/436","id":254033326,"user":{"login":"mfazekas","id":52435,"avatar_url":"https://avatars.githubusercontent.com/u/52435?v=3","gravatar_id":"","url":"https://api.github.com/users/mfazekas","html_url":"https://github.com/mfazekas","followers_url":"https://api.github.com/users/mfazekas/followers","following_url":"https://api.github.com/users/mfazekas/following{/other_user}","gists_url":"https://api.github.com/users/mfazekas/gists{/gist_id}","starred_url":"https://api.github.com/users/mfazekas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfazekas/subscriptions","organizations_url":"https://api.github.com/users/mfazekas/orgs","repos_url":"https://api.github.com/users/mfazekas/repos","events_url":"https://api.github.com/users/mfazekas/events{/privacy}","received_events_url":"https://api.github.com/users/mfazekas/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T08:02:34Z","updated_at":"2016-10-16T08:02:34Z","body":"@willbryant If you use net-ssh correctly (closing net-ssh session) it should close the IO object returned by IO.popen. That will not leave any zombie process behind.\r\n\r\nThis\r\n```ruby\r\np = IO.popen('echo hello')\r\nputs p.read()\r\np.close()\r\n```\r\nwill not leave any zombie process. Nor should correct use of net-ssh. \r\n\r\nIf you disagree, send concrete testcase (ruby code). That's something we can discuss, i don't have time for anything else."}}
{"actor":{"display_login":"mfazekas"}}