[Bugfix][Core] add seq_id_to_seq_group clearing to avoid memory leak when s… (#16472)

Signed-off-by: 开哲 <kaizhe.zy@alibaba-inc.com>
Co-authored-by: 开哲 <kaizhe.zy@alibaba-inc.com>
This commit is contained in:
张宇 2025-04-24 11:25:37 +08:00 committed by GitHub
parent ed2e464653
commit 6167c0e5d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -179,6 +179,13 @@ class RequestOutput:
group.finish_seq(seq_group)
if assembled_seq_group is None:
return None
# clear finished seq in seq_id_to_seq_group
if len(group.to_be_finished) == 0:
for sub_request_id in list(group.seq_id_to_index.keys()):
if sub_request_id in seq_id_to_seq_group:
del seq_id_to_seq_group[sub_request_id]
return cls.from_seq_group(assembled_seq_group, use_cache,
seq_id_to_seq_group)