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 15, 19:45 UTC
[MISC][V1] Register process killing handler only in the main thread (#14380)
Signed-off-by: Cody Yu <hao.yu.cody@gmail.com>
Cody Yu committed
Mar 7, 2025 at 22:40 UTC
9f3bc0f58c431404f02372e22b4050460e2be448
1 file changed
+9
-1
vllm/v1/engine/core_client.py
+9
-1
@@ -4,6 +4,7 @@ import asyncio
4
import os
5
import queue
6
import signal
7
+import threading
8
import uuid
9
import weakref
10
from abc import ABC, abstractmethod
@@ -260,7 +261,14 @@ class MPClient(EngineCoreClient):
261
"down. See stack trace above for root cause issue.")
262
kill_process_tree(os.getpid())
263
263
- signal.signal(signal.SIGUSR1, sigusr1_handler)
264
+ if threading.current_thread() == threading.main_thread():
265
+ signal.signal(signal.SIGUSR1, sigusr1_handler)
266
+ else:
267
+ logger.warning("SIGUSR1 handler not installed because we are not "
268
+ "running in the main thread. In this case the "
269
+ "forked engine process may not be killed when "
270
+ "an exception is raised, and you need to handle "
271
+ "the engine process shutdown manually.")
272
273
# Serialization setup.
274
self.encoder = MsgpackEncoder()