Project

General

Profile

Actions

Bug #37500

closed

Killing of spawned processes isn't 100% reliable

Added by Adam Ruzicka 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Found in Releases:

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.

Actions #1

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)

Actions #2

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
Actions #3

Updated by The Foreman Bot 6 months ago

  • Fixed in Releases smart_proxy_remote_execution_ssh-0.10.5 added
Actions #4

Updated by Adam Ruzicka 6 months ago

  • Status changed from Ready For Testing to Closed
Actions #5

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)
Actions

Also available in: Atom PDF