[错误] 可信度低的 `migration_request` 可能会终止 DistServe 解码引擎循环,从而导致持续拒绝服务
分析和测试的版本:- 运行时版本:LMDeploy `v0.17.0` 根本原因链如下。首先,完成和聊天完成 OpenAI 兼容的入口点都直接从外部 JSON 请求体中读取 `migration_request`:- `lmdeploy/serve/OpenAI/endpoints/completions.py:130-135` - `lmdeploy/serve/OpenAI/chat_completions/serving.py:180-185` 相关代码:Python migration_request = json_request.pop('migration_request', None) with_cache = json_request.pop('with_cache', False) preserve_cache = json_request.pop('preserve_cache', False) if migration_request: migration_request = MigrationRequest.model_validate(migration_request) 这仅执行 Pydantic 形状验证。它不验证该字段是否由可信的代理生成,也不会验证迁移数据的语义一致性。`MigrationRequest` 在 `lmdeploy/pytorch/disagg/conn/protocol.py:93-101` 中定义:Python class MigrationRequest(BaseModel): protocol: MigrationProtocol remote_engine_id: str remote_session_id: int remote_token_id: int remote_block_ids: list[int] is_dummy_prefill: bool = False 公共 API 路径不进行验证,例如:- `remote_engine_id` 是否是可信的和连接的对端;- `protocol` 是否匹配当前启用的迁移后端;- 远程缓存池/会话/块元数据是否存在;- `remote_block_ids` 是否匹配在 Decode 端实际分配的块表。当请求包含 `migration_request` 时,序列被放入 `MIGRATION_WAITING` 而不是…
内容来源: InternLM/lmdeploy