Fix KPO hanging indefinitely when init_container_logs=True and pod stays in Pending#68450
Merged
jscheffl merged 1 commit intoJun 12, 2026
Conversation
jscheffl
approved these changes
Jun 12, 2026
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
imrichardwu
pushed a commit
to imrichardwu/airflow
that referenced
this pull request
Jun 16, 2026
…pache#68450) Co-authored-by: Jayachandra Kasarla <jayachandra.kasarla@MacBook-Pro.local>
dingo4dev
pushed a commit
to dingo4dev/airflow
that referenced
this pull request
Jun 16, 2026
…pache#68450) Co-authored-by: Jayachandra Kasarla <jayachandra.kasarla@MacBook-Pro.local>
75 tasks
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.
Closes #68445
Problem
When KubernetesPodOperator is configured with
init_container_logs=True, the task hangs indefinitely if the pod never leaves the Pending phase (e.g. due to an invalid node_selector, missing node pool, or resource exhaustion).With
init_container_logs=False,PodLaunchTimeoutExceptionis raised correctly afterstartup_timeout_seconds / schedule_timeout_seconds. Withinit_container_logs=True, the task never times out and the pod is never cleaned up.You can reproduce the issue using the following DAG code:
Fix
Made
self.await_pod_start()to run beforeself.await_init_containers_completion()to ensure the pod has fully started before attempting to stream init container logs, preventing KPO from hanging when init container log streaming was triggered against a pod still in PENDING state.Was generative AI tooling used to co-author this PR?
[X] Yes
Used Claude Sonnet to understand the codebase and assist with implementing the changes.