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 7, 02:45 UTC
Revert "[BugFix] Fix engine hanging after KV cache initialization fai… (#36262)
Nick Hill committed
Mar 6, 2026 at 08:28 UTC
26bd43b52df305c5610efed9e72261d263b9fe75
2 files changed
+25
-59
vllm/v1/engine/core.py
+25
-54
@@ -1,6 +1,5 @@
1
# SPDX-License-Identifier: Apache-2.0
2
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3
-import contextlib
3
import os
4
import queue
5
import signal
@@ -120,17 +119,9 @@ class EngineCore:
119
self._eep_scale_up_before_kv_init()
120
121
# Setup KV Caches and update CacheConfig after profiling.
123
- try:
124
- num_gpu_blocks, num_cpu_blocks, kv_cache_config = (
125
- self._initialize_kv_caches(vllm_config)
126
- )
127
- except Exception:
128
- logger.exception(
129
- "EngineCore failed during KV cache initialization; "
130
- "shutting down executor."
131
- )
132
- self.model_executor.shutdown()
133
- raise
122
+ num_gpu_blocks, num_cpu_blocks, kv_cache_config = self._initialize_kv_caches(
123
+ vllm_config
124
+ )
125
126
vllm_config.cache_config.num_gpu_blocks = num_gpu_blocks
127
vllm_config.cache_config.num_cpu_blocks = num_cpu_blocks
@@ -976,49 +967,29 @@ class EngineCoreProc(EngineCore):
967
addresses = self.startup_handshake(
968
handshake_socket, local_client, headless, parallel_config_to_update
969
)
979
- exc_during_init = False
980
- try:
981
- yield addresses
982
- except Exception:
983
- exc_during_init = True
984
- raise
985
- finally:
986
- if exc_during_init:
987
- # Send FAILED status so the front-end detects init
988
- # failure immediately via ZMQ instead of waiting for
989
- # process sentinel (which may be delayed by cleanup).
990
- with contextlib.suppress(Exception):
991
- handshake_socket.send(
992
- msgspec.msgpack.encode(
993
- {
994
- "status": "FAILED",
995
- "local": local_client,
996
- "headless": headless,
997
- }
998
- )
999
- )
1000
- else:
1001
- # Send ready message.
1002
- num_gpu_blocks = vllm_config.cache_config.num_gpu_blocks
1003
- # We pass back the coordinator stats update address
1004
- # here for the external LB case for our colocated
1005
- # front-end to use (coordinator only runs with rank 0).
1006
- dp_stats_address = self.frontend_stats_publish_address
1007
-
1008
- # Include config hash for DP configuration validation
1009
- ready_msg = {
1010
- "status": "READY",
1011
- "local": local_client,
1012
- "headless": headless,
1013
- "num_gpu_blocks": num_gpu_blocks,
1014
- "dp_stats_address": dp_stats_address,
1015
- }
1016
- if vllm_config.parallel_config.data_parallel_size > 1:
1017
- ready_msg["parallel_config_hash"] = (
1018
- vllm_config.parallel_config.compute_hash()
1019
- )
970
+ yield addresses
971
+
972
+ # Send ready message.
973
+ num_gpu_blocks = vllm_config.cache_config.num_gpu_blocks
974
+ # We pass back the coordinator stats update address here for the
975
+ # external LB case for our colocated front-end to use (coordinator
976
+ # only runs with rank 0).
977
+ dp_stats_address = self.frontend_stats_publish_address
978
+
979
+ # Include config hash for DP configuration validation
980
+ ready_msg = {
981
+ "status": "READY",
982
+ "local": local_client,
983
+ "headless": headless,
984
+ "num_gpu_blocks": num_gpu_blocks,
985
+ "dp_stats_address": dp_stats_address,
986
+ }
987
+ if vllm_config.parallel_config.data_parallel_size > 1:
988
+ ready_msg["parallel_config_hash"] = (
989
+ vllm_config.parallel_config.compute_hash()
990
+ )
991
1021
- handshake_socket.send(msgspec.msgpack.encode(ready_msg))
992
+ handshake_socket.send(msgspec.msgpack.encode(ready_msg))
993
994
@staticmethod
995
def startup_handshake(
vllm/v1/engine/utils.py
-5
@@ -1130,11 +1130,6 @@ def wait_for_engine_startup(
1130
1131
start_pending[0 if local else 1] -= 1
1132
engine.state = CoreEngineState.READY
1133
- elif status == "FAILED":
1134
- raise RuntimeError(
1135
- f"Engine core {eng_index} reported initialization failure. "
1136
- "See root cause above."
1137
- )
1133
else:
1134
raise RuntimeError(
1135
f"Unexpected {status} message for "