fix(kubernetes): do not fail task when xcom sidecar kill fails after successful XCom read - #71372
Open
waterWang wants to merge 2 commits into
Open
fix(kubernetes): do not fail task when xcom sidecar kill fails after successful XCom read#71372waterWang wants to merge 2 commits into
waterWang wants to merge 2 commits into
Conversation
waterWang
requested review from
hussein-awala,
jedcunningham and
jscheffl
as code owners
August 10, 2026 11:49
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.
Issue
Closes #71369
Problem
When
KubernetesPodOperatoris used withdo_xcom_push=True, the XCom sidecar container starts and the XCom value is read successfully from/airflow/xcom/return.json. However, the subsequentextract_xcom_killstep attempts to terminate the sidecar viakill -2overkubectl exec, which fails withPermission deniedon certain container runtimes (e.g., k3s/containerd).Because
extract_xcom_killis called in thefinallyblock ofextract_xcom, thePodCommandExceptionpropagates and discards the already-retrieved XCom value, causing the task to be marked asFaileddespite the payload being successfully read.Fix
Wrap
extract_xcom_killin an inner try/except in thefinallyblock. Since the XCom value has already been successfully retrieved, a failure to clean up the sidecar is a non-fatal issue — the sidecar will be cleaned up when the pod is deleted (peron_finish_action). The exception is logged as a warning instead of failing the task.Test
Added
test_extract_xcom_kill_failure_does_not_fail_taskwhich verifies that whenextract_xcom_killraisesPodCommandException, theextract_xcommethod still returns the successfully-read XCom value.