Fix API server memory leak from KubernetesExecutor Manager processes#68697
Closed
Subham-KRLX wants to merge 1 commit into
Closed
Fix API server memory leak from KubernetesExecutor Manager processes#68697Subham-KRLX wants to merge 1 commit into
Subham-KRLX wants to merge 1 commit into
Conversation
d5434a4 to
127d7c8
Compare
127d7c8 to
a3b4aab
Compare
Contributor
|
I've decided to merge Kaxil's equivalent PR as it provides a more comprehensive solution. |
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.
When the API server serves logs for RUNNING task instances it was instantiating KubernetesExecutor to obtain get_task_log. Each instantiation creates a multiprocessing.Manager() process (~350-400 MB) that runs forever and is never cleaned up. This caused one leaked Manager per API worker accumulating with worker refresh cycles and leading to OOMs.
The fix loads the executor class without instantiation and uses the existing _get_task_log_static classmethod when available, preventing Manager process creation. Falls back to instantiation for executors without the static method.
closes: #68693
Was generative AI tooling used to co-author this PR?