Fix zombie upscaler processes by killing child processes and upscaler binaries in stop.py
This commit is contained in:
@@ -56,6 +56,18 @@ def stop() -> None:
|
|||||||
|
|
||||||
print(f"🛑 Stopping server (PID {pid}) …")
|
print(f"🛑 Stopping server (PID {pid}) …")
|
||||||
|
|
||||||
|
# Clean up child processes of the server and any lingering upscaler binaries
|
||||||
|
import subprocess
|
||||||
|
try:
|
||||||
|
subprocess.run(["pkill", "-P", str(pid)], capture_output=True)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
subprocess.run(["pkill", "-f", "realesrgan-ncnn-vulkan"], capture_output=True)
|
||||||
|
subprocess.run(["pkill", "-f", "rife-ncnn-vulkan"], capture_output=True)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
# Graceful shutdown (SIGTERM)
|
# Graceful shutdown (SIGTERM)
|
||||||
os.kill(pid, signal.SIGTERM)
|
os.kill(pid, signal.SIGTERM)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user