Repository navigation
[Bugfix] Tell a stopped engine core apart from a dead one during AsyncLLM shutdown - #63337
Open
stefankoncarevic wants to merge 3 commits into
Open
stefankoncarevic wants to merge 3 commits into
stefankoncarevic wants to merge 3 commits into
Conversation
…cLLM shutdown Signed-off-by: Stefan Koncarevic <Stefan.Koncarevic@amd.com>
stefankoncarevic
requested review from
DarkLight1337,
NickLucche,
njhill,
shen-shanshan and
ywang96
as code owners
October 23, 2026 11:58
stefankoncarevic
requested review from
AndreasKaratzas and
aoshen02
and removed request for
DarkLight1337,
NickLucche,
njhill,
shen-shanshan and
ywang96
October 23, 2026 11:59
|
✅ @stefankoncarevic, CI is now available for this PR.
|
Collaborator
Author
|
/ci run |
|
✅ Triggered Buildkite CI #96882 for commit |
Member
|
Thanks @stefankoncarevic. I have a proposal for a simpler variation: njhill@bb1051e Please take a look and feel free to cherry-pick here if it looks good to you. |
This branch has not been deployed
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.
Overview
AsyncLLM.shutdown()stops the engine core before it cancels the background output handler, and the launcher runsshutdown()in an executor thread, so the event loop keeps turning in between. A read already in flight then finds the core gone and raisesEngineDeadError, which the handler logs asAsyncLLM output_handler failed.with a full traceback. That is a clean shutdown reported as a crash. This teaches the handler to tell the two apart.Behaviour does not change. The handler still propagates the error to the output processor and still returns, and a core that dies outside
shutdown()is still reported as a failure. Only the log line changes.Validation
In the
(H100) [Nightly] Elastic EP Scalingstep of build 96848 the step passes, 5 passed in 1448 s, and still prints two of these:That branch does not carry this change. The line right after the error is what identifies the window: the API server is shutting its engine client down, so the core was asked to stop. I see the same tracebacks in the same group on MI300X, on unmodified main, so this is neither platform specific nor something I introduced.
With the change I no longer see
AsyncLLM output_handler failed.or any traceback in that window, on MI300X or on H100. The handler logs one info line instead.tests/v1/engine/test_async_llm_shutdown_race.pycovers both sides: a stop thatshutdown()asked for is logged as info, and a death outsideshutdown()is still logged as an error. The second test is the one that matters, since it keeps the new branch from swallowing a core that really died.tests/v1/shutdown/passes, 19 passed and 4 skipped on L4 and the same on MI300X.tests/multimodal/test_cache.pypasses, and so do the four other test files that build anAsyncLLMwithout running__init__, 84 tests, with no ignored exception from__del__.Details
Why a one element list. The output handler must not capture
self, or theAsyncLLMkeeps a circular reference through the task and is never garbage collected, which makesdel enginehang. The file already solves this the same way for the logger, withself._logger_ref = [self.logger_manager], so I follow that pattern. I hit the trap first with a plain attribute read inside the closure, andtest_async_llm_deletetimed out on all four parametrizations.Where the flag is set. First thing in
shutdown(), before the engine core is stopped, because the handler reads it on the event loop whileshutdown()runs in an executor thread. Setting it later leaves a window where the core is gone and the flag is still false, which is the case being fixed.Why the read is guarded.
__del__callsshutdown(), soshutdown()can run on an engine whose__init__never finished, which is why every other attribute it touches goes throughgetattr. I do the same, otherwise a half built engine raisesAttributeErrorout of__del__as noise on top of whatever really went wrong at startup.Test stub.
tests/multimodal/test_cache.pycallsAsyncLLM._run_output_handlerunbound against aSimpleNamespacethat supplies the attributes the method reads. It now supplies_shutting_down_reftoo.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.