Skip to content

Commit

Permalink
Runtime: do not send kill to init
Browse files Browse the repository at this point in the history
  • Loading branch information
LifeDJIK committed Nov 27, 2024
1 parent ae60caa commit d5daf12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pylon/core/tools/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
#
Expand Down
2 changes: 1 addition & 1 deletion pylon/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit d5daf12

Please sign in to comment.