[Bugfix] Restore user config/runtime stage init timeout (#2519)

Signed-off-by: yuanheng <jonathan.zhaoyh@gmail.com>
Signed-off-by: Yuanheng Zhao <jonathan.zhaoyh@gmail.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: SYLAR <125541396+lishunyang12@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-04-12 00:48:47 +08:00
1 parent 6e93595822
commit c20cac86ce
16 files changed
+207 -29

No files matched your search

+4 -1
View File
@@ -430,7 +430,9 @@ class AsyncOmniEngine:
else:
assert proc is not None
assert handshake_address is not None
complete_stage_handshake(proc, handshake_address, addresses, vllm_config)
complete_stage_handshake(
proc, handshake_address, addresses, vllm_config, stage_init_timeout
)
logger.info("[AsyncOmniEngine] Stage %s engine startup completed", metadata.stage_id)
finally:
if previous_visible_devices is None:
@@ -759,6 +761,7 @@ class AsyncOmniEngine:
self.model,
stage_cfg,
metadata,
stage_init_timeout=stage_init_timeout,
batch_size=self.diffusion_batch_size,
)
logger.info(
+12 -7
View File
@@ -37,8 +37,6 @@ if TYPE_CHECKING:
logger = init_logger(__name__)
_HANDSHAKE_POLL_TIMEOUT_S = 600
class StageEngineCoreProc(EngineCoreProc):
"""Stage-specific engine core process for vLLM-Omni.
@@ -145,13 +143,14 @@ def complete_stage_handshake(
handshake_address: str,
addresses: EngineZmqAddresses,
vllm_config: VllmConfig,
handshake_timeout: int,
) -> None:
"""Perform the HELLO/INIT/READY handshake with an already-spawned proc.
On failure the process is terminated before re-raising.
"""
try:
_perform_handshake(proc, handshake_address, addresses, vllm_config)
_perform_handshake(proc, handshake_address, addresses, vllm_config, handshake_timeout)
except Exception:
shutdown([proc])
raise
@@ -162,6 +161,7 @@ def _perform_handshake(
handshake_address: str,
addresses: EngineZmqAddresses,
vllm_config: VllmConfig,
handshake_timeout: int,
) -> None:
"""Run the HELLO / INIT / READY handshake with the subprocess."""
with zmq_socket_ctx(handshake_address, zmq.ROUTER, bind=True) as handshake_socket:
@@ -169,7 +169,7 @@ def _perform_handshake(
poller.register(handshake_socket, zmq.POLLIN)
poller.register(proc.sentinel, zmq.POLLIN)
identity, msg = _recv(poller, handshake_socket, proc, "HELLO")
identity, msg = _recv(poller, handshake_socket, proc, "HELLO", handshake_timeout)
if msg.get("status") != "HELLO":
raise RuntimeError(f"Expected HELLO, got: {msg}")
@@ -179,7 +179,7 @@ def _perform_handshake(
)
handshake_socket.send_multipart([identity, msgspec.msgpack.encode(init_payload)])
identity, msg = _recv(poller, handshake_socket, proc, "READY")
identity, msg = _recv(poller, handshake_socket, proc, "READY", handshake_timeout)
if msg.get("status") != "READY":
raise RuntimeError(f"Expected READY, got: {msg}")
num_gpu_blocks = msg.get("num_gpu_blocks")
@@ -192,13 +192,18 @@ def _recv(
handshake_socket: zmq.Socket,
proc: BaseProcess,
expected: str,
timeout_s: int = 600,
) -> tuple[bytes, dict]:
"""Wait for one handshake message; raise if the process dies first."""
timeout_ms = _HANDSHAKE_POLL_TIMEOUT_S * 1000
timeout_ms = timeout_s * 1000
while True:
events = dict(poller.poll(timeout=timeout_ms))
if not events:
raise TimeoutError(f"Timed out waiting for {expected} from StageEngineCoreProc")
raise TimeoutError(
f"Timed out waiting for {expected} from StageEngineCoreProc after {timeout_s}s. "
f"This typically indicates model loading or initialization is taking too long. "
f"Consider increasing `stage_init_timeout` for large models."
)
if handshake_socket in events:
identity, raw = handshake_socket.recv_multipart()
return identity, msgspec.msgpack.decode(raw)
+6 -2
View File
@@ -335,7 +335,7 @@ def build_vllm_config(
def acquire_device_locks(
stage_id: int,
engine_args_dict: dict[str, Any],
stage_init_timeout: int = 300,
stage_init_timeout: int,
) -> list[int]:
"""Acquire exclusive file locks on devices needed by this stage.
@@ -528,6 +528,7 @@ def initialize_diffusion_stage(
model: str,
stage_cfg: Any,
metadata: StageMetadata,
stage_init_timeout: int,
batch_size: int = 1,
) -> Any:
"""Build a diffusion stage client.
@@ -536,6 +537,7 @@ def initialize_diffusion_stage(
model: Model name or path.
stage_cfg: Stage configuration.
metadata: Extracted stage metadata.
stage_init_timeout: Timeout in seconds for stage initialization handshake
batch_size: Maximum number of requests to batch together in the
diffusion engine. Passed through to ``StageDiffusionClient``
and ultimately to ``AsyncOmni``.
@@ -543,7 +545,9 @@ def initialize_diffusion_stage(
from vllm_omni.diffusion.stage_diffusion_client import StageDiffusionClient
od_config = build_diffusion_config(model, stage_cfg, metadata)
return StageDiffusionClient(model, od_config, metadata, batch_size=batch_size)
return StageDiffusionClient(
model, od_config, metadata, stage_init_timeout=stage_init_timeout, batch_size=batch_size
)
def _shutdown_or_close_resource(resource: Any, resource_name: str, stage_id: int) -> None: