A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 9, 17:06 UTC
[Core][Bugfix] allow graceful worker termination (#32965)
Signed-off-by: Joe Runde <Joseph.Runde@ibm.com>
Joe Runde committed
Jan 23, 2026 at 18:28 UTC
7e1f10d5622afe0049ba31765fa84a452dbfe9cb
1 file changed
+18
-5
vllm/v1/executor/multiproc_executor.py
+18
-5
@@ -391,14 +391,17 @@ class MultiprocExecutor(Executor):
391
time.sleep(0.1)
392
return False
393
394
+ active_procs = lambda: [proc for proc in worker_procs if proc.is_alive()]
395
+ # Give processes time to clean themselves up properly first
396
+ if wait_for_termination(active_procs(), 4):
397
+ return
398
+
399
# Send SIGTERM if still running
395
- active_procs = [proc for proc in worker_procs if proc.is_alive()]
396
- for p in active_procs:
400
+ for p in active_procs():
401
p.terminate()
398
- if not wait_for_termination(active_procs, 4):
402
+ if not wait_for_termination(active_procs(), 4):
403
# Send SIGKILL if still running
400
- active_procs = [p for p in active_procs if p.is_alive()]
401
- for p in active_procs:
404
+ for p in active_procs():
405
p.kill()
406
407
def shutdown(self):
@@ -701,6 +704,9 @@ class WorkerProc:
704
nonlocal shutdown_requested
705
if not shutdown_requested:
706
shutdown_requested = True
707
+ logger.debug(
708
+ "WorkerProc handling signal %d, raising SystemExit", signum
709
+ )
710
raise SystemExit()
711
712
# Either SIGTERM or SIGINT will terminate the worker
@@ -774,6 +780,13 @@ class WorkerProc:
780
# SystemExit() to avoid zmq exceptions in __del__.
781
shutdown_requested = True
782
783
+ except SystemExit as e:
784
+ # SystemExit is raised on SIGTERM or SIGKILL, which usually indicates that
785
+ # the graceful shutdown process did not succeed
786
+ logger.warning("WorkerProc was terminated")
787
+ # SystemExit must never be ignored
788
+ raise e
789
+
790
finally:
791
if ready_writer is not None:
792
ready_writer.close()