[BugFix] Handle errors when preprocessing added requests (#30895)
Signed-off-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
+33
-2
@@ -43,9 +43,11 @@ from vllm.v1.core.kv_cache_utils import (
|
||||
from vllm.v1.core.sched.interface import SchedulerInterface
|
||||
from vllm.v1.core.sched.output import SchedulerOutput
|
||||
from vllm.v1.engine import (
|
||||
EngineCoreOutput,
|
||||
EngineCoreOutputs,
|
||||
EngineCoreRequest,
|
||||
EngineCoreRequestType,
|
||||
FinishReason,
|
||||
ReconfigureDistributedRequest,
|
||||
ReconfigureRankType,
|
||||
UtilityOutput,
|
||||
@@ -1055,9 +1057,14 @@ class EngineCoreProc(EngineCore):
|
||||
request_type = EngineCoreRequestType(bytes(type_frame.buffer))
|
||||
|
||||
# Deserialize the request data.
|
||||
request: Any
|
||||
if request_type == EngineCoreRequestType.ADD:
|
||||
request = add_request_decoder.decode(data_frames)
|
||||
request = self.preprocess_add_request(request)
|
||||
req: EngineCoreRequest = add_request_decoder.decode(data_frames)
|
||||
try:
|
||||
request = self.preprocess_add_request(req)
|
||||
except Exception:
|
||||
self._handle_request_preproc_error(req)
|
||||
continue
|
||||
else:
|
||||
request = generic_decoder.decode(data_frames)
|
||||
|
||||
@@ -1141,6 +1148,30 @@ class EngineCoreProc(EngineCore):
|
||||
# Limit the number of buffers to reuse.
|
||||
reuse_buffers.append(buffer)
|
||||
|
||||
def _handle_request_preproc_error(self, request: EngineCoreRequest) -> None:
|
||||
"""Log and return a request-scoped error response for exceptions raised
|
||||
from the add request preprocessing in the input socket processing thread.
|
||||
"""
|
||||
logger.exception(
|
||||
"Unexpected error pre-processing request %s", request.request_id
|
||||
)
|
||||
self.output_queue.put_nowait(
|
||||
(
|
||||
request.client_index,
|
||||
EngineCoreOutputs(
|
||||
engine_index=self.engine_index,
|
||||
finished_requests={request.request_id},
|
||||
outputs=[
|
||||
EngineCoreOutput(
|
||||
request_id=request.request_id,
|
||||
new_token_ids=[],
|
||||
finish_reason=FinishReason.ERROR,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class DPEngineCoreProc(EngineCoreProc):
|
||||
"""ZMQ-wrapper for running EngineCore in background process
|
||||
|
||||
Reference in New Issue
Block a user