Repository navigation
Fix zombie pods by adding synchronization volume for XCom sidecar - #74501
Himani78116 wants to merge 2 commits into
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
developer-rpai
left a comment
There was a problem hiding this comment.
Good diagnosis of the zombie-pod problem — the sidecar lingering after the base container exits is a real pain.
But there's a gap between the description and the diff:
- The description says the base container signals completion by writing to the shared volume so the sidecar can detect the exit and terminate — but the diff only adds the volume and mounts. Nothing writes the sentinel file and nothing in the sidecar watches for it. Is the write/watch half coming in a follow-up, or was it omitted? As written, the volume alone changes no pod lifecycle.
pod.spec.volumes.append(V1Volume(name="airflow-xcom-sync", ...))is unconditional — if a user already passed a volume with that name involumes=, the pod spec gets a duplicate volume name and the API server rejects the pod at creation. A collision guard (or a less generic name) is worth adding.- The sidecar is found via
pod.spec.containers[-1]and the base via[0]. If pod-building ever appends containers after the sidecar, or the user injects containers, the mount lands on the wrong container. Selecting by container name would be more robust. - The new tests cover pod-spec shape only — the actual termination behavior has no test. Fair enough if it needs a live cluster, but worth saying so explicitly.
|
Thanks for taking the time to review this ! |
Description
When do_xcom_push=True is used in KubernetesPodOperator, a sidecar container is added to handle XCom extraction. However, this sidecar often remains in a Running state even after the base container has completed its work, resulting in "zombie pods" that linger in the cluster and consume resources.
This PR implements a synchronization mechanism using a shared emptyDir volume (sentinel pattern).
Changes Made:
Verification Results
Checklist
Was generative AI tooling used to co-author this PR?