Detect and recover from crashed/unresponsive worker processes#283
Merged
Conversation
knipknap
force-pushed
the
fix/tasker-worker-crash-detection
branch
from
June 8, 2026 10:28
f5905ff to
1e73dd1
Compare
Workers track their active task in a DictProxy (survives result queue corruption from crashed peers). The listener health check detects: - Dead workers via is_alive() — emits worker_died for orphan cleanup - Poisoned result queues (no results for 3s) — restarts all stuck workers - Per-worker timeouts (30s) — terminates unresponsive workers individually Workers now send a 'running' message with their PID so per-worker start times are tracked. Cancelled tasks are skipped early in the worker loop before running user_func, preventing stale tasks from blocking the queue. Replacement workers are spawned automatically.
The early cancellation check (workers skip already-cancelled tasks) is the proper root cause fix: it prevents cancelled tasks from blocking workers during rapid pipeline invalidations. The poisoned queue and per-worker timeout detections masked this issue rather than fixing it.
knipknap
force-pushed
the
fix/tasker-worker-crash-detection
branch
from
June 8, 2026 20:20
9665c18 to
107c686
Compare
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.
Summary
Worker pool improvements to detect and recover from crashed or unresponsive worker processes.
Worker crash detection
_wpool:{pid}) which survives result queue corruption from crashed peersis_alive()and emitsworker_diedsignals for orphaned task cleanupEarly cancel check
user_func, skipping already-cancelled tasks immediately. This prevents stale cancelled tasks from blocking the queue and starving current-generation tasks.Infrastructure
"running"message with PID on task start, enabling_worker_start_timetracking_spawn_replacement_worker()/_terminate_stuck_worker()for worker lifecycle managementworker_diedsignal connected to TaskManager for orphan finalization_pid_to_worker/_worker_task_maptracking for health checksFiles
rayforge/shared/tasker/pool.py— health checks, stuck worker termination, early cancel, running messagerayforge/shared/tasker/manager.py—_on_pool_worker_diedhandlertests/tasker/test_pool.py— updated cancel test to accept pre-emptive skip