Repository navigation
Fix vLLM server hangs after worker errors - #6628
DaoyuanLi2816 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8c59574. Configure here.
|
This PR's target code was removed by #6765 ("Use vLLM's own server instead of TRL's", merged 2026-08-26). That PR took Confirmed on current main: The underlying failure mode (issue #3433, a worker error hanging the HTTP request) may still be worth checking against vLLM's own DP server now that TRL delegates to it — but that would be a vLLM-side fix, not a TRL one, so this PR's diff has no file left to apply to. Might be worth closing with a pointer to #6765, and re-filing against vllm-project/vllm if the hang still reproduces there. |

What does this PR do?
A vLLM data-parallel worker currently exits when an engine call raises. The server then waits indefinitely on its pipe, which leaves the HTTP request hanging and can surface as an NCCL timeout on the training ranks.
This change:
No user-facing API changes or new dependencies are introduced.
Fixes #3433
Before submitting
max_model_lenis no smaller than the number of text tokens. " #3433 and the maintainer diagnosis in [GRPO] NCCL timeout when GRPO training with vllm, but get "ValueError: The decoder prompt (length 5951) is longer than the maximum model length of 4096. Make sure thatmax_model_lenis no smaller than the number of text tokens. " #3433 (comment).Validation:
python -m pytest tests/test_vllm_client_server.py -m "not slow" -q(11 passed, 42 deselected)ruff check trl/scripts/vllm_serve.py tests/test_vllm_client_server.pyruff format --check trl/scripts/vllm_serve.py tests/test_vllm_client_server.pyAI writing disclosure
We welcome the use of AI tools to help with contributions. For transparency and to help us improve our review process, please indicate the level of AI involvement in this PR.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag members/contributors who may be interested in your PR.
Note
Medium Risk
Touches all DP parent?worker pipe paths for generation and related endpoints; behavior on failure changes from hang to RuntimeError, which is intended but affects production error handling during RL training.
Overview
Fixes indefinite hangs on the vLLM data-parallel serve path when a worker?s engine call fails (e.g. prompt too long) instead of returning a response.
Worker IPC now uses a small protocol: successful
callreplies are{"result": ...}and failures are{"error": {"type", "message"}}so the worker stays alive. The parent uses_recv_worker_resultseverywhere it used to block on rawrecv()(generate, chat, logprobs dispatch, reset prefix cache), raisingRuntimeErrorwith the worker error when any DP rank fails. The parent also closes the child pipe end after spawning each worker.CPU multiprocessing tests cover error round-trip through
_run_llm_workerand that one worker?s error still drains paired results before the next receive.Reviewed by Cursor Bugbot for commit f8a909a. Bugbot is set up for automated code reviews on this repo. Configure here.