From d8ca7fee751b676dccfcf3e5dd2a23c2979853e6 Mon Sep 17 00:00:00 2001 From: Shirley125 <54166744+Shirley125@users.noreply.github.com> Date: Mon, 27 Oct 2025 16:56:09 +0800 Subject: [PATCH] [bugfix][main]fix proxy decode bug (#3750) ### What this PR does / why we need it? fix proxy decode bug when parsing non-UTF-8 characters. - vLLM version: v0.11.0 - vLLM main: https://github.com/vllm-project/vllm/commit/c9461e05a4ed3557cfbf4b15ded1e26761cc39ca --------- Signed-off-by: CHEN <116010019@link.cuhk.edu.cn> --- .../load_balance_proxy_layerwise_server_example.py | 8 +++++++- .../load_balance_proxy_server_example.py | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/examples/disaggregated_prefill_v1/load_balance_proxy_layerwise_server_example.py b/examples/disaggregated_prefill_v1/load_balance_proxy_layerwise_server_example.py index c6001553..7e80b55c 100644 --- a/examples/disaggregated_prefill_v1/load_balance_proxy_layerwise_server_example.py +++ b/examples/disaggregated_prefill_v1/load_balance_proxy_layerwise_server_example.py @@ -556,7 +556,13 @@ async def _handle_completions(api: str, request: Request): instance_info.prefiller_idx, instance_info.prefiller_score) released_kv = True - chunk_str = chunk.decode("utf-8").strip() + try: + chunk_str = chunk.decode("utf-8").strip() + except UnicodeDecodeError: + logger.debug( + f"Skipping chunk: {chunk}") + yield chunk + continue if not chunk_str: continue if chunk_str.startswith("data: "): diff --git a/examples/disaggregated_prefill_v1/load_balance_proxy_server_example.py b/examples/disaggregated_prefill_v1/load_balance_proxy_server_example.py index 880ed69e..0694aced 100644 --- a/examples/disaggregated_prefill_v1/load_balance_proxy_server_example.py +++ b/examples/disaggregated_prefill_v1/load_balance_proxy_server_example.py @@ -539,7 +539,13 @@ async def _handle_completions(api: str, request: Request): instance_info.prefiller_idx, instance_info.prefiller_score) released_kv = True - chunk_str = chunk.decode("utf-8").strip() + try: + chunk_str = chunk.decode("utf-8").strip() + except UnicodeDecodeError: + logger.debug( + f"Skipping chunk: {chunk}") + yield chunk + continue if not chunk_str: continue if chunk_str.startswith("data: "):