Skip to content

[Bugfix] V1 Fix the cursor leakage issue during request scheduling. #21173

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

CLFutureX
Copy link

@CLFutureX CLFutureX commented Jul 18, 2025

Background: When iterating through running requests, if preemption occurs and the preempted request is before the current cursor req_index, subsequent requests will be missed during scheduling.

Solution: When the preempted request is determined to be before the current cursor req_index, adjust the cursor to move forward to avoid missing requests.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request aims to fix a bug in the scheduler where requests could be missed during preemption. The proposed logic correctly identifies the condition for adjusting the loop cursor. However, the implementation contains a critical bug that will cause a TypeError at runtime when trying to find the index of the preempted request. I've provided a suggestion to fix this issue.

Copy link

👋 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 fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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 ready label to the PR or enable auto-merge.

🚀

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @CLFutureX, good catch!

Copy link
Member

@njhill njhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @WoosukKwon to confirm

@CLFutureX CLFutureX force-pushed the fix_running_index branch from 2100ff3 to a352810 Compare July 20, 2025 09:01
@njhill njhill added the ready ONLY add when PR is ready to merge/full CI is needed label Jul 21, 2025
@njhill
Copy link
Member

njhill commented Jul 21, 2025

@CLFutureX would you mind rebasing on latest main? I think the test failures are transient things that should now be fixed.

@mergify mergify bot added documentation Improvements or additions to documentation ci/build frontend llama Related to Llama models multi-modality Related to multi-modality (#4194) labels Jul 22, 2025
@mergify mergify bot removed the tpu Related to Google TPUs label Jul 23, 2025
@CLFutureX CLFutureX force-pushed the fix_running_index branch from 1fc2ec2 to b60dc81 Compare July 23, 2025 02:59
Copy link
Collaborator

@WoosukKwon WoosukKwon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Can we add a test about this?

@CLFutureX
Copy link
Author

@CLFutureX I think the rebase wasn't done quite right - the PR shouldn't have all of these commits

yes, I'm sorry. I accidentally rebased the code onto the wrong branch yesterday, but I've since reverted it and adjusted the branch properly.

@DarkLight1337 DarkLight1337 removed documentation Improvements or additions to documentation performance Performance-related issues new-model Requests to new models frontend speculative-decoding ci/build multi-modality Related to multi-modality (#4194) tool-calling llama Related to Llama models qwen Related to Qwen models labels Jul 23, 2025
@njhill njhill added the bug Something isn't working label Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants