Repository navigation
Keep LocalExecutor running when a worker dies holding the queue read lock - #74588
Open
anmolxlight wants to merge 9 commits into
Open
anmolxlight wants to merge 9 commits into
anmolxlight wants to merge 9 commits into
Conversation
anmolxlight
requested review from
XD-DENG,
ashb,
dheerajturaga,
hussein-awala,
o-nikolas and
pierrejeambrun
as code owners
October 12, 2026 12:15
…lock Signed-off-by: anmolxlight <anmolxlight@gmail.com>
Signed-off-by: anmolxlight <anmolxlight@gmail.com>
…i_transport_lifecycle thread-liveness assert; no code change)
…rmination (no code change)
anmolxlight
force-pushed
the
fix-74575-localexecutor-dead-worker-lock
branch
from
October 14, 2026 15:56
f882c6f to
76d11de
Compare
…ce hit job-timeout (no code change)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #74575.
Problem
LocalExecutorgave all workers oneSimpleQueueas their input. In CPython,SimpleQueue.get()holds a shared read lock while it blocks on the pipe. If the idle worker holding that lock is SIGKILLed (for example by the OOM killer), nothing releases the lock. Every other worker then waits on it forever, and the executor keeps accepting work it can never run. Tasks stayqueuedwhile the scheduler reports healthy.Fix
Give each worker its own input queue and dispatch each workload to a specific worker:
_dispatchpicks an idle worker, spawns one underparallelism, or queues behind a busy one._dispatched), so a worker that dies before START still leaves the key for the scheduler's stuck-in-queued revoke, as before.running, so a worker is not left excluded.Tests
test_workload_runs_after_worker_holding_read_lock_is_killed: kills all idle workers, then requires a later task to succeed. Onmainit fails with the symptom from the issue (task never leaves the queue, 30s timeout). With this fix it passes (~3.6s).test_local_executor_check_workers.pyfor the new reap contract.test_local_executor.pyandtest_local_executor_check_workers.py: 65 passed, 1 skipped.test_base_executor.pyhas 3test_debug_dump*errors that also occur on unmodifiedmain; unrelated.ruff check,ruff format --check, andmypyonlocal_executor.pyare clean.Notes
This does not change behavior when workers stay alive. The per-worker queue is also what makes a killed worker harmless to the rest of the pool.