-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
[Core][BugFix] Fix thread safety issue in RequestOutputCollector #22576
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: 22quinn <[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 🚀 |
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.
Code Review
This pull request correctly addresses a critical thread-safety issue in RequestOutputCollector
. By using loop.call_soon_threadsafe()
, it ensures that the asyncio.Event
is set safely from a different thread, preventing potential deadlocks. This is the standard and correct approach for such cross-thread communication with asyncio. The change is well-implemented and effectively resolves the race condition.
When does this need to be called from a separate thread? There is only one thread in the AsyncLLM IIUC |
Seems some nuance in our complex setup caused this and it's consistently reproducible. I've been trying to construct a small repro but not able yet |
@22quinn yes this should not be required. It would only be needed if the |
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
We need to safely set
asyncio.Event()
from a different thread otherwise it could lead to hang issue in some cases whereawait self.ready.wait()
remains blocked although the event was set.Test Plan
Tested with a vendor setup.
Test Result
Tested with a vendor setup.
(Optional) Documentation Update