-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
[BugFix] Fix Memory Leak #17567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BugFix] Fix Memory Leak #17567
Conversation
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
Signed-off-by: [email protected] <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for locating the memory leak and the fix!
vllm/v1/core/sched/scheduler.py
Outdated
# NOTE(rob): since we free stopped reqs above, adding stopped reqs | ||
# to _cached_reqs_data will cause a memory leak. | ||
if req_data.req_id not in stopped_set: | ||
self._cached_reqs_data[req_data.req_id].append(req_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just do the following so that we don't need to introduce stopped_set
?
if req_data.req_id in self._cached_reqs_data:
self._cached_reqs_data[req_data.req_id].append(req_data)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that would work unless line 541 is changed from self._cached_reqs_data.get(request.request_id)
to self._cached_reqs_data[request.request_id]
.
Alternatively I think you could use if req_data.req_id not in self.finished_req_ids
to avoid having a new set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea
Signed-off-by: [email protected] <[email protected]>
Signed-off-by: [email protected] <[email protected]>
any plans to fix in V0? batching with phi mini (3.5 and 4), lora_enabled - V0 showed degraded performance yesterday, responses showing signs of context from other prompts |
@nightflight-dk sorry for a sidetrack, but I wanted to clarify since I don't understand the issue well here, do you mean that the chunked prefill, if enabled in V0, potentially leads to prompt mixing? There was a phenomenon like that for prefix caching due to hash function's behaviour in python 3.12 #12621 , but it got fixed for me in |
Is it means that if I upgrade vllm to v0.8.5.post1, and use option "--enable-prefix-caching" when start a model service, it will not have memory leak, right? |
Signed-off-by: [email protected] <[email protected]> Signed-off-by: Mu Huai <[email protected]>
Syncing midstream NM fork to Upstream tag of [v0.8.5.post1](https://github.com/vllm-project/vllm/tree/v0.8.5.post1) + cherry pick of vllm-project@be633fb needed for benchmarks + [CP](neuralmagic/nm-vllm-ent@1fe447d) for compressed tensor bump + [CP](vllm-project#17677) for lora on AMD + [CP](vllm-project#17315) for llama4 w/ pure dense layers ``` commit 31c73ba (HEAD -> upstream-v0.8.5, nm-fork/upstream-v0.8.5) Author: Chauncey <[email protected]> Date: Wed Apr 30 15:11:04 2025 +0800 [Bugfix] Fix AttributeError: 'State' object has no attribute 'engine_client' (vllm-project#17434) Signed-off-by: chaunceyjiang <[email protected]> commit f8db0bd Author: Lucas Wilkinson <[email protected]> Date: Fri May 2 14:01:38 2025 -0400 [BugFix][Attention] Fix sliding window attention in V1 giving incorrect results (vllm-project#17574) Signed-off-by: Lucas Wilkinson <[email protected]> commit e335c34 Author: Robert Shaw <[email protected]> Date: Fri May 2 04:07:03 2025 -0400 [BugFix] Fix Memory Leak (vllm-project#17567) Signed-off-by: [email protected] <[email protected]> commit cc463fe Merge: 1e358ff ba41cc9 Author: Selbi Nuryyeva <[email protected]> Date: Tue Apr 29 12:34:57 2025 -0400 Merge branch 'tag-upstream-v0.8.5' into upstream-v0.8.5 commit ba41cc9 (tag: v0.8.5, tag-upstream-v0.8.5) Author: Michael Goin <[email protected]> Date: Mon Apr 28 16:20:24 2025 -0600 [Model] Add tuned triton fused_moe configs for Qwen3Moe (vllm-project#17328) Signed-off-by: mgoin <[email protected]> commit dcbac4c Author: Simon Mo <[email protected]> Date: Mon Apr 28 14:12:01 2025 -0700 [Model] Qwen3 Dense FP8 Compat Fixes (vllm-project#17318) Signed-off-by: simon-mo <[email protected]> [...] ``` Commands ``` git fetch upstream git checkout -b upstream-v0.8.5 git merge upstream/v0.8.5 git cherry-pick be633fb ``` TEST PLAN accept sync: https://github.com/neuralmagic/nm-cicd/actions/runs/14841223552 related PR in cicd: neuralmagic/nm-cicd#99 release workflow: https://github.com/neuralmagic/nm-cicd/actions/runs/14845693864
This issue does not impact V0. Its related to the V1 scheduler |
Signed-off-by: [email protected] <[email protected]> Signed-off-by: Yuqi Zhang <[email protected]>
Signed-off-by: [email protected] <[email protected]> Signed-off-by: minpeter <[email protected]>
SUMMARY: