fix: serialize concurrent vLLM engine startup - #282
Merged
Merged
Conversation
Yunnglin
force-pushed
the
feat/dashserving-adapter
branch
from
September 14, 2026 03:04
162d5da to
992349b
Compare
Yunnglin
marked this pull request as ready for review
September 14, 2026 03:13
There was a problem hiding this comment.
🟡 Changes recommended
The lock scope and test synchronization need correction before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This pull request serializes concurrent vLLM engine startup within a pod and adds regression coverage for cross-process locking.
Changes:
- Adds a pod-local startup lock around vLLM engine initialization.
- Adds a multiprocessing lock-serialization test.
File summaries
| File | Review summary |
|---|---|
tests/sampler/test_vllm_startup_lock.py |
The test may not reliably prove the second process attempted lock acquisition. |
src/twinkle/sampler/vllm_sampler/vllm_sampler.py |
Model downloading occurs while the startup lock is held, broadening the critical section. |
Review details
Suppressed comments (1)
src/twinkle/sampler/vllm_sampler/vllm_sampler.py:130
- This lock is acquired before
VLLMEngineconstruction, butVLLMEngine.__init__callsHubOperation.download_model(model_id)before creating the vLLM engine. Consequently, a slow or failed hub/filesystem download holds the pod-wide mutex and blocks every other sampler startup, so the lock is not limited to the port-sensitive engine startup described in the deployment note. Resolve/cache the model before taking the lock, or narrow the critical section to theAsyncLLMcreation itself.
with _vllm_engine_startup_lock():
self.engine: VLLMEngine = self._run_in_loop(self._create_engine_async(VLLMEngine, model_id, engine_kwargs))
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
hjh0119
approved these changes
Sep 14, 2026
tastelikefeet
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
get_open_port()race that caused one TP=2 sampler replica to fail withEADDRINUSEValidation
conda run -n twinkle python -m pytest tests/sampler/test_vllm_startup_lock.py -qpre-commit run --files src/twinkle/sampler/vllm_sampler/vllm_sampler.py tests/sampler/test_vllm_startup_lock.pyDeployment note
The vLLM lock is local to a pod and held only while an engine reaches ready state. It does not alter Ray or Megatron process-group ports, GPU allocation, sampling request concurrency, or DashServing-related code.