Semaphore release Issue in api_generate_stream Function of vllm_worker
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.5k
- Forks
- 4.8k
- PR merge metrics
- No merged PRs in 30d
Description
I've been examining the `api_generate_stream` function in the `fastchat/serve/vllm_worker.py` file and I've noticed a potential issue related to the semaphore release.
In the current implementation, if an exception occurs during the execution of `worker.generate_stream(params)`
https://github.com/lm-sys/FastChat/blob/main/fastchat/serve/vllm_worker.py#L205
the `create_background_tasks(request_id)` function might not be called. This could lead to the semaphore not being properly released.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in fastchat/serve/vllm_worker.py at api_generate_stream and the referenced line around worker.generate_stream(params). Trace the exception path and inspect how create_background_tasks(request_id) controls semaphore release. Done means the semaphore is released when generation raises an exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100