Bug #37500
closedKilling of spawned processes isn't 100% reliable
Description
Currently we spawn a somewhat deep hierarchy of processes.
For a simple "while true; sleep 1; done" we spawn something like this
bash(28973)─┬─sh(28992)───sudo(28995)───sudo(28999)───sh(29000)───sleep(29174)
└─tee(28993)
As part of the preparation, we stored pid of the second-level shell (28992 in this case). When the job is cancelled (be it by the user or because the timeout to kill was reached), we send a SIGINT to all processes which have the second-level shell as its parent - in this case sudo(28995) and then rely on that process to either pass the signal to its children and so on. Sadly this isn't completely reliable and the leaf processes can stick around and just be re-parented under init.
If we lean into some features provided by the kernel (namely namespaces), we should be able to make this much more reliable at least on platforms which support this.
Updated by Adam Ruzicka 6 months ago
The formatting got messed up
bash(28973)─┬─sh(28992)───sudo(28995)───sudo(28999)───sh(29000)───sleep(29174) └─tee(28993)
Updated by The Foreman Bot 6 months ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/smart_proxy_remote_execution_ssh/pull/115 added
Updated by The Foreman Bot 6 months ago
- Fixed in Releases smart_proxy_remote_execution_ssh-0.10.5 added
Updated by Adam Ruzicka 6 months ago
- Status changed from Ready For Testing to Closed
Applied in changeset foreman_proxy_plugin|9a47f834702a4d2057f05fb3413529c1fa66aa20.
Updated by Adam Ruzicka 5 months ago
- Fixed in Releases smart_proxy_remote_execution_ssh-0.10.6 added
- Fixed in Releases deleted (
smart_proxy_remote_execution_ssh-0.10.5)