Skip to content

Fix API server memory leak from KubernetesExecutor Manager processes#68697

Closed
Subham-KRLX wants to merge 1 commit into
apache:mainfrom
Subham-KRLX:fix/k8s-executor-manager-leak
Closed

Fix API server memory leak from KubernetesExecutor Manager processes#68697
Subham-KRLX wants to merge 1 commit into
apache:mainfrom
Subham-KRLX:fix/k8s-executor-manager-leak

Conversation

@Subham-KRLX

@Subham-KRLX Subham-KRLX commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

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?

  • Yes - Claude Sonnet 4.5(For pr description and code research)

@boring-cyborg boring-cyborg Bot added area:logging area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Jun 18, 2026
@Subham-KRLX Subham-KRLX marked this pull request as draft June 18, 2026 05:45
@Subham-KRLX Subham-KRLX force-pushed the fix/k8s-executor-manager-leak branch 2 times, most recently from d5434a4 to 127d7c8 Compare June 18, 2026 07:14
@Subham-KRLX Subham-KRLX force-pushed the fix/k8s-executor-manager-leak branch from 127d7c8 to a3b4aab Compare June 18, 2026 07:15
@Subham-KRLX Subham-KRLX marked this pull request as ready for review June 18, 2026 08:25
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 25, 2026
@shahar1

shahar1 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

I've decided to merge Kaxil's equivalent PR as it provides a more comprehensive solution.
Thanks for tackling it!

@shahar1 shahar1 closed this Jul 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:logging area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API server leaks a KubernetesExecutor multiprocessing.Manager process per worker when viewing RUNNING task logs

3 participants