diff --git a/pylon/core/tools/signal.py b/pylon/core/tools/signal.py index 5dd1203..e806eee 100644 --- a/pylon/core/tools/signal.py +++ b/pylon/core/tools/signal.py @@ -34,7 +34,7 @@ def signal_sigterm(signal_num, stack_frame): raise SystemExit -def kill_remaining_processes(): +def kill_remaining_processes(context): """ Send SIGKILL to all other processes """ try: current_pid = os.getpid() @@ -44,7 +44,10 @@ def kill_remaining_processes(): # for pid in running_pids: if pid == current_pid: - continue + continue # Skip pylon itself + # + if pid == 1 and context.runtime_init == "dumb-init": + continue # Skip init # log.info("Killing remaining process: %s", pid) # diff --git a/pylon/main.py b/pylon/main.py index caa37ea..dfbf5ff 100644 --- a/pylon/main.py +++ b/pylon/main.py @@ -199,7 +199,7 @@ def main(): # pylint: disable=R0912,R0914,R0915 # Kill remaining processes to avoid keeping the container running on update if context.settings.get("system", {}).get("kill_remaining_processes", True) and \ context.runtime_init in ["pylon", "dumb-init"]: - kill_remaining_processes() + kill_remaining_processes(context) # Exit log.info("Exiting")