fix(consolidation): release large objects between retry attempts to prevent RSS leak (#2273)#2795
Open
handnewb wants to merge 1 commit into
Open
fix(consolidation): release large objects between retry attempts to prevent RSS leak (#2273)#2795handnewb wants to merge 1 commit into
handnewb wants to merge 1 commit into
Conversation
…revent RSS leak When a consolidation LLM call fails repeatedly, the call_kwargs dict (containing the full system_prompt and user_content strings — potentially hundreds of KB of text) and the response object were kept in scope across the retry loop. With consolidation_max_attempts=5, repeated failures could accumulate hundreds of MB of unreclaimable memory. This adds explicit cleanup in a finally block between retry attempts. Closes vectorize-io#2273
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.
Summary
When a consolidation LLM call fails repeatedly, the
call_kwargsdict (containing the full system_prompt and user_content strings — potentially hundreds of KB of text) and theresponseobject were kept in scope across the retry loop. Withconsolidation_max_attempts=5and retry storms, repeated failures could accumulate hundreds of MB of unreclaimable memory, eventually causing OOM.Changes
call_kwargsandresponseasNonebefore the retry loopfinallyblock with explicitdelto release references between retry attemptstry/except NameErrorguards for safety (the variables may not be assigned if the exception occurs before their assignment line, though in practice this never happens)Verification
Closes #2273