Fix race condition in LoRA streaming requests#2954
Merged
Conversation
HappyAmazonian
previously approved these changes
Nov 19, 2025
xyang16
reviewed
Nov 19, 2025
xyang16
reviewed
Nov 19, 2025
Member
Author
|
Manual testing confirms adapter is getting utilized |
xyang16
reviewed
Nov 19, 2025
engines/python/setup/djl_python/lmi_vllm/request_response_utils.py
Outdated
Show resolved
Hide resolved
xyang16
approved these changes
Nov 19, 2025
HappyAmazonian
pushed a commit
that referenced
this pull request
Nov 19, 2025
HappyAmazonian
added a commit
that referenced
this pull request
Nov 19, 2025
ksuma2109
pushed a commit
that referenced
this pull request
Nov 19, 2025
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.
The Bug
When using vLLM async service with LoRA adapters, streaming requests were not receiving the
lora_requestparameter. This was due to an async generator timing issue in the original implementation.Original Implementation (Buggy)
Problem: For streaming requests,
inference_invokerreturns anAsyncGeneratorthat hasn't started executing yet. The wrapper is removed in thefinallyblock before the generator actually runs and callsadd_request.The Fix
The fix passes
adapterdirectly as a parameter to the OpenAI Request object and then send it to inference invoker instead of wrapping the method:This ensures the
lora_requestis properly passed to vLLM's OpenAI serving methods for both streaming and non-streaming requests.Testing
Manual testing confirms adapter is getting utilized