schizophrenicmaniac opened a new pull request, #74611: URL: https://github.com/apache/airflow/pull/74611
An idle LocalExecutor worker waits in `activity_queue.get()` while holding the SimpleQueue's read lock. If that worker is killed (OOM killer, `kill -9`), the lock is never released. Replacement workers wait on the same dead lock, so every task queued afterwards stays queued until the scheduler is restarted. When `_check_workers()` reaps a worker that died without a workload, it can't tell whether that worker held the lock, so it now replaces the activity queue: - The executor keeps track of the workloads it has dispatched that no worker has reported as started. Those get put on a new queue, and fresh workers are started to read it. The old pipe is never read, because its lock may be held by a dead process. - Idle workers on the old queue are killed. Busy ones keep running their current task and are killed once it finishes. The executor also takes the old queue's lock if it's free and keeps it, so a worker that finishes can't pick up a workload that has already moved to the new queue. - Workers terminated by `revoke_task` don't trigger a replacement, since they were running a task and couldn't have held the lock. `end()` kills retired workers instead of sending them a shutdown message they'd never read. A side effect: a workload taken by a worker that died before reporting START is now re-run right away, instead of waiting for the stuck-in-queued timeout. The new tests include a real-process one that kills the worker holding the lock and checks that a task queued afterwards still runs. Without the fix it times out. closes: #74575 --- ##### Was generative AI tooling used to co-author this PR? - [ ] Yes (please specify the tool below) --- * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information. Note: commit author/co-author name and email in commits become permanently public when merged. * For fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed. * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x). * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number. -- 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]
