waterWang opened a new pull request, #71372: URL: https://github.com/apache/airflow/pull/71372
### Issue Closes #71369 ### Problem When `KubernetesPodOperator` is used with `do_xcom_push=True`, the XCom sidecar container starts and the XCom value is **read successfully** from `/airflow/xcom/return.json`. However, the subsequent `extract_xcom_kill` step attempts to terminate the sidecar via `kill -2` over `kubectl exec`, which fails with `Permission denied` on certain container runtimes (e.g., k3s/containerd). Because `extract_xcom_kill` is called in the `finally` block of `extract_xcom`, the `PodCommandException` propagates and **discards the already-retrieved XCom value**, causing the task to be marked as `Failed` despite the payload being successfully read. ### Fix Wrap `extract_xcom_kill` in an inner try/except in the `finally` block. 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 (per `on_finish_action`). The exception is logged as a warning instead of failing the task. ### Test Added `test_extract_xcom_kill_failure_does_not_fail_task` which verifies that when `extract_xcom_kill` raises `PodCommandException`, the `extract_xcom` method still returns the successfully-read XCom value. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
