[Bugfix] Fail a duplex session that outgrows max_model_len instead of killing the EngineCore (#7277)

Signed-off-by: Tianyao Wu <rayroy31@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
authored and GitHub committed 2026-09-16 20:08:25 +08:00
1 parent e6cebf8557
commit fa639b889e
7 files changed
+582 -3

No files matched your search

+45 -1
View File
@@ -30,7 +30,7 @@ from vllm.logger import init_logger
from vllm.outputs import CompletionOutput, RequestOutput
from vllm.pooling_params import PoolingParams
from vllm.sampling_params import RequestOutputKind, SamplingParams
from vllm.v1.engine import EngineCoreOutputs
from vllm.v1.engine import EngineCoreOutputs, FinishReason
from vllm.v1.engine.exceptions import EngineDeadError
from vllm.v1.metrics.stats import IterationStats
@@ -777,6 +777,7 @@ class OrchestratorBase:
)
if await self._apply_raw_terminal_stage_finish(stage_id, eco, req_state):
raw_terminal_request_ids.add(req_state.request_id)
await self._report_duplex_session_request_error(stage_id, replica_id, eco, req_state)
iteration_stats = IterationStats() if (self._stat_logger is not None and raw_outputs.outputs) else None
processed = await pool.process_llm_raw_outputs(
replica_id,
@@ -1503,6 +1504,49 @@ class OrchestratorBase:
req_state.finished_final_output_stage_ids.add(stage_id)
return True
async def _report_duplex_session_request_error(
self,
stage_id: int,
replica_id: int | None,
eco: Any,
req_state: OrchestratorRequestState,
) -> None:
"""Turn a scheduler-side error finish of a duplex session request into a request error.
A duplex session request is resumable, so its terminal outputs are
deliberately not turned into processed outputs
(``_finish_raw_terminal_requests`` skips duplex sessions), and vLLM's
output processor may already have dropped the request state by the
time the raw ``FinishReason.ERROR`` output arrives. Without this the
session never learns that its request is gone: the next append
re-creates the request from scratch and the session silently loses
its context. Deliver the error to the request's consumer instead so
the serving layer can fail and close the session.
"""
if not req_state.session_owned:
return
if getattr(eco, "finish_reason", None) != FinishReason.ERROR:
return
if getattr(eco, "is_segment_finished", False):
return
stop_reason = getattr(eco, "stop_reason", None)
error = stop_reason if isinstance(stop_reason, str) and stop_reason else "duplex session request failed"
logger.error(
"[Orchestrator] Duplex session request %s failed at stage-%s replica-%s: %s",
req_state.request_id,
stage_id,
replica_id,
error,
)
await self.output_async_queue.put(
ErrorMessage(
error=error,
fatal=False,
request_id=req_state.request_id,
stage_id=stage_id,
)
)
async def _finish_raw_terminal_requests(
self,
stage_id: int,