Skip to content

Fail deferrable KPO when a GC'd pod takes its XCom with it - #73131

Closed
rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix/kpo-deferral-pod-gone-xcom
Closed

rjgoyln wants to merge 1 commit into
apache:mainfrom
rjgoyln:fix/kpo-deferral-pod-gone-xcom

Conversation

@rjgoyln

@rjgoyln rjgoyln commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A deferrable KubernetesPodOperator with do_xcom_push=True can be incorrectly marked as SUCCESS when its pod is reclaimed after the trigger fires but before the worker resumes the task.

When the pod is reclaimed, its XCom sidecar is removed with it, so the XCom result never reaches Airflow. The 404 handling introduced in #66716 currently treats the missing pod as a successful completion and returns None. Since trigger_reentry's return value becomes the task's return_value, this leaves the task successful but without the result it was expected to produce.

This can cause downstream tasks to receive an unexpected None and fail during templating. Retrying the downstream task cannot recover the missing XCom; the upstream task must be cleared and rerun.

Changes

  • Keep the existing silent-success behavior when do_xcom_push is unset, since only the pod logs are lost in this case.
  • Raise PodNotFoundException when do_xcom_push is enabled, so the task can be retried and the pod — along with its XCom result — can be recreated.
  • Continue translating the 404 into PodNotFoundException instead of allowing the raw ApiException to escape, preserving the fix from KubernetesPodOperator deferrable: trigger_reentry crashes when pod is GC'd before re-entry #66715.

No opt-in flag is added; this follows the first approach proposed in the issue.

Tests

  • Added a regression test covering a GC'd pod after successful trigger re-entry with do_xcom_push=True. The test fails on main.
  • Updated the existing GC'd-on-success test to explicitly set do_xcom_push=False, making it clear that the test covers the existing silent-success behavior.

closes: #73117


Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5)

Generated-by: Claude Code (Opus 5) following the guidelines

A pod reclaimed between the trigger firing and the worker resuming the task
takes the XCom sidecar with it. Returning normally in that case reports the
task as successful while pushing no return_value, so downstream tasks that
template on it fail with an error that points nowhere near the cause and no
retry of the downstream can ever recover.

Restore the loud failure for tasks that are contracted to produce a value:
only a task with do_xcom_push unset can still succeed on a vanished pod,
where the pod logs are the only thing lost.

closes: apache#73117
@boring-cyborg boring-cyborg Bot added area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues labels Sep 14, 2026
@rjgoyln
rjgoyln marked this pull request as ready for review September 14, 2026 19:11
@potiuk potiuk added the closed because of open PR limit Closed as a one-time step of introducing the open pull request limit label Sep 25, 2026
@potiuk

potiuk commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hello @rjgoyln - thank you for your contributions to Apache Airflow!

The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 24 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:

These pull requests stay open because maintainers are already engaged in them - they count towards your limit:

This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are.

What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or gh pr reopen <PR_NUMBER> --repo apache/airflow. Reopen the ones you are ready to follow through - keep them rebased, respond to review comments and fix failing checks.

While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack.

Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers closed because of open PR limit Closed as a one-time step of introducing the open pull request limit provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deferrable KubernetesPodOperator marks task SUCCESS without pushing XCom when the pod is gone at re-entry (regression from #66716, provider 10.17.1+)

2 participants