Conversation
…**attrs Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
hanouticelina
approved these changes
Apr 13, 2026
Contributor
hanouticelina
left a comment
There was a problem hiding this comment.
the fix looks good to me 👍
Wauplin
added a commit
that referenced
this pull request
Apr 14, 2026
…estruction (#4092) * Fix reference cycle in hf_raise_for_status by extending _format with **attrs Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> * simpler tests * syntax --------- Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
This PR has been shipped as part of the v1.10.2 release. |
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.
Why? PR equivalent to #4084 but slightly cleaner. Should solved vLLM garbage collection problem (vllm-project/vllm#38384). It seems that in #3889 we've introduced a reference cycle issue in
hf_raise_for_status, making it impossible to free-up memory correctly.I have tested the regression test introduced in this PR and it does fail on
mainKudos to @yg7445 for investigating + suggesting the solution. This was not an easy bug to spot!
Summary
Fixes a CPython reference cycle in
hf_raise_for_status()that prevents deterministic exception cleanup.When exceptions are stored in local variables before
raise ... from e, a reference cycle forms:err.__cause__→e→e.__traceback__→ frame →f_locals['err']→ back to start. This delays garbage collection and causes real issues downstream (e.g., vLLM GPU memory not released until cyclic GC runs). See vllm-project/vllm#38384.Alternative approach to #4084: instead of introducing two new helper functions, this extends the existing
_format()with**attrsso attributes (likerepo_type,repo_id,bucket_id) are set inside_formatand the exception is never stored in the caller's frame.Changes
_format()to accept**attrskeyword arguments, set as attributes on the errorhf_raise_for_statusfrom local-variable pattern to inlineraise _format(...) from eweakrefto verify no reference cycle exists🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit 8ba3871. Configure here.