From 7732bbe458f68518afbf2835d6e8ef9e1cd4437b Mon Sep 17 00:00:00 2001 From: huangtingwei <141888744+huangtingwei9988@users.noreply.github.com> Date: Tue, 24 Jun 2025 10:36:23 +0800 Subject: [PATCH] bugfix: Prevent global mutation of conv.stop_str across requests (#7347) Co-authored-by: Chang Su --- python/sglang/srt/entrypoints/openai/serving_chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/entrypoints/openai/serving_chat.py b/python/sglang/srt/entrypoints/openai/serving_chat.py index b91fee18c..ea72452e1 100644 --- a/python/sglang/srt/entrypoints/openai/serving_chat.py +++ b/python/sglang/srt/entrypoints/openai/serving_chat.py @@ -1,3 +1,4 @@ +import copy import json import logging import time @@ -292,7 +293,7 @@ class OpenAIServingChat(OpenAIServingBase): image_data = conv.image_data if conv.image_data else None audio_data = conv.audio_data if conv.audio_data else None modalities = conv.modalities if conv.modalities else [] - stop = conv.stop_str or [] if not request.ignore_eos else [] + stop = copy.copy(conv.stop_str or [] if not request.ignore_eos else []) if request.stop: if isinstance(request.stop, str):