Unverified Commit 60524920 authored by Kebe's avatar Kebe Committed by GitHub
Browse files

[Bug]: Fix maximum recursion depth triggered on exception exit (#3519)

parent 10771026
...@@ -499,14 +499,17 @@ def kill_process_tree(parent_pid, include_parent: bool = True, skip_pid: int = N ...@@ -499,14 +499,17 @@ def kill_process_tree(parent_pid, include_parent: bool = True, skip_pid: int = N
pass pass
if include_parent: if include_parent:
try: if parent_pid == os.getpid():
itself.kill() sys.exit(0)
else:
try:
itself.kill()
# Sometime processes cannot be killed with SIGKILL (e.g, PID=1 launched by kubernetes), # Sometime processes cannot be killed with SIGKILL (e.g, PID=1 launched by kubernetes),
# so we send an additional signal to kill them. # so we send an additional signal to kill them.
itself.send_signal(signal.SIGQUIT) itself.send_signal(signal.SIGQUIT)
except psutil.NoSuchProcess: except psutil.NoSuchProcess:
pass pass
def monkey_patch_p2p_access_check(): def monkey_patch_p2p_access_check():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment