Review fixes: CUDA restore in finally, os._exit on Windows, taskkill /T for process tree, build-server-cuda error handling, db-init path

This commit is contained in:
Jamie Pine
2026-03-15 05:43:26 -07:00
parent f1ba73a386
commit e239be5bbb
3 changed files with 25 additions and 16 deletions
+7 -1
View File
@@ -119,7 +119,13 @@ def _start_parent_watchdog(parent_pid, data_dir=None):
while True:
if not _is_pid_alive(parent_pid):
watchdog_logger.info(f"Parent process {parent_pid} gone, shutting down server...")
os.kill(os.getpid(), signal.SIGTERM)
if sys.platform == "win32":
# sys.exit triggers SystemExit, allowing uvicorn to run
# shutdown handlers. os.kill(SIGTERM) on Windows calls
# TerminateProcess which hard-kills without cleanup.
os._exit(0)
else:
os.kill(os.getpid(), signal.SIGTERM)
return
time.sleep(2)