airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Ignore stale executor success when TI is queued after defer

Open goingforstudying-ctrl opened this issue 5 months ago • 2 comments

Fixes a race where the trigger resumes a deferred task to queued (rather than scheduled) before the scheduler processes the executor SUCCESS from the worker defer exit. The scheduler then treated queued vs executor success as a state mismatch and failed the TI (#67287).

The fix for #66374 (#66431) added handling for the scheduled variant. Under load the trigger may reschedule into either queued or scheduled depending on scheduler loop timing, so both states must be treated as stale defer-exit events when next_method is set.

Changes:

  • Extend ti_requeued condition in process_executor_events to include TaskInstanceState.QUEUED
  • Add test_process_executor_events_stale_success_when_queued_after_defer (positive + negative without next_method)
  • Add newsfragment 67287.bugfix.rst

Testing:

pytest airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_process_executor_events_stale_success_when_queued_after_defer -q
  • closes: #67287

goingforstudying-ctrl avatar Jun 19 '26 06:06 goingforstudying-ctrl

Thanks for the review. I updated the commit message to remove the conventional commit style from the PR title as requested. Let me know if anything else needs adjustment.

goingforstudying-ctrl avatar Jun 19 '26 18:06 goingforstudying-ctrl

Fixed the PR title to remove conventional commit style. Let me know if anything else needs adjustment.

goingforstudying-ctrl avatar Jun 20 '26 02:06 goingforstudying-ctrl

Please stop merging main. This PR will never be merged if you keep doing this.

uranusjr avatar Jul 02 '26 02:07 uranusjr

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

boring-cyborg[bot] avatar Jul 02 '26 19:07 boring-cyborg[bot]