xchwan commented on issue #72716:
URL: https://github.com/apache/airflow/issues/72716#issuecomment-7314421816

   Looking at this against current `main`: I think the LocalExecutor case you 
hit was already fixed by #74142 (released in 3.4.0). Since then LocalExecutor 
adds dispatched work to `running` and keeps a per-key dispatch count, so while 
the resumed attempt runs `executor.has_task(ti)` is true and the stale 
defer-exit success takes the existing "requeued" branch instead of the 
state-mismatch path. On 3.3.x LocalExecutor never added dispatched work to 
`running`, which is why `has_task` was false in your timeline.
   
   To check it, I ran `main` on a kind cluster with LocalExecutor, one 
scheduler, and two test-only patches: one hands executor events to the 
scheduler 8s late (mimicking the lag in your timeline), the other logs the 
guard inputs whenever a success event arrives for a RUNNING task instance. With 
2 runs of 50 tasks that defer for 1s and then stay running for 20s, a stale 
defer-exit success reached the scheduler while the resumed attempt was already 
RUNNING for 62 task instances. In all 62, `has_task` was true (the key was in 
`running` with a dispatch count of 1), `queued_by_job_id` matched the 
scheduler's job id, and the event was treated as requeued: no state mismatch, 
and all 100 task instances succeeded.
   
   Could you check whether it still happens for you on 3.4.0? If it does not, 
this can probably be closed.
   
   ---
   Drafted-by: Claude Code (Opus 5.5); reviewed by `xchwan` before posting
   


-- 
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]

Reply via email to