Skip to content

Drain result_queue before dispatch to prevent runtime deadlock in LocalExecutor - #70545

Open
SakshamKapoor2911 wants to merge 2 commits into
apache:mainfrom
SakshamKapoor2911:fix-local-executor-dispatch-deadlock
Open

Drain result_queue before dispatch to prevent runtime deadlock in LocalExecutor#70545
SakshamKapoor2911 wants to merge 2 commits into
apache:mainfrom
SakshamKapoor2911:fix-local-executor-dispatch-deadlock

Conversation

@SakshamKapoor2911

@SakshamKapoor2911 SakshamKapoor2911 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fixes a runtime deadlock in LocalExecutor where the scheduler blocks indefinitely on activity_queue.put() during task dispatch, a gap left by #67881 which only addressed the shutdown path.

Workers fill the result_queue pipe buffer and block on put(). Blocked workers stop consuming activity_queue, so the scheduler blocks on activity_queue.put() and never reaches _read_results() to drain the pipe — a circular deadlock.

The fix: drain result_queue via _read_results() before each activity_queue.put() in _process_workloads, using the same drain-before-write pattern already applied to end().

closes: #70526


Was generative AI tooling used to co-author this PR?
  • Yes — OpenCode (DeepSeek v4 Pro)

Generated-by: OpenCode (DeepSeek v4 Pro) following the guidelines

…alExecutor

Call _read_results() before each activity_queue.put() in _process_workloads
so workers blocked on a full result_queue pipe can resume reading from
activity_queue, preventing the circular deadlock described in apache#70526.

This is the dispatch-side equivalent of the fix applied to end() in apache#67881.
Verify _read_results() is called before each activity_queue.put() during dispatch, guarding against the dispatch-side deadlock described in apache#70526.
@SakshamKapoor2911
SakshamKapoor2911 force-pushed the fix-local-executor-dispatch-deadlock branch from f03a04a to df19a88 Compare July 27, 2026 17:10
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 28, 2026
@SakshamKapoor2911

Copy link
Copy Markdown
Contributor Author

@eladkal @amoghrajesh — all CI checks pass. Fixes a LocalExecutor shutdown deadlock. Ready for maintainer review.

@eladkal eladkal added this to the Airflow 3.3.1 milestone Jul 31, 2026
@eladkal eladkal added type:bug-fix Changelog: Bug Fixes backport-to-v3-3-test Backport to v3-3-test labels Jul 31, 2026
@vatsrahul1001

Copy link
Copy Markdown
Contributor

LGTM! should be good to merged post code owner review

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

Labels

area:Executors-core LocalExecutor & SequentialExecutor backport-to-v3-3-test Backport to v3-3-test ready for maintainer review Set after triaging when all criteria pass. type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scheduler deadlocks in pipe write during task dispatch (LocalExecutor) — runtime variant of #67881

4 participants