fix(worker): reclaim stale tasks from dead workers - #992
Closed
r266-tech wants to merge 2 commits into
Closed
Conversation
When a worker dies without graceful shutdown (OOM-killed, node failure, container restart), its claimed async_operations rows stay in 'processing' indefinitely. Because consolidation uses per-bank serialization, stale claims also block all new work on affected banks. The existing recover_own_tasks only recovers tasks for the same worker_id, which doesn't help when a container restarts with a new hostname. Add a periodic reclaim_stale_tasks pass to the polling loop that resets tasks from other workers when claimed_at exceeds a configurable timeout (default 15 minutes). Own in-flight tasks are never touched. Fixes vectorize-io#991
nicoloboschi
requested changes
Apr 13, 2026
nicoloboschi
left a comment
Collaborator
There was a problem hiding this comment.
we don't want to implement this for now. we need to figure out why workers are stuck
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
When a worker dies without graceful shutdown (OOM-killed, node failure, container restart with new hostname), its claimed
async_operationsrows stay inprocessingindefinitely. The existingrecover_own_tasksonly recovers tasks for the sameworker_id, which doesn't help when a container restarts with a new hostname.Because consolidation uses per-bank serialization (
NOT EXISTS ... status='processing'), stale claims also block all new work on affected banks — the live worker sees slots occupied by a dead hostname and never claims pending tasks.Changes
reclaim_stale_tasks()method toWorkerPollerthat periodically resets tasks from other workers whenclaimed_atexceeds a configurable timeout (default 15 minutes)worker_id IS DISTINCT FROM $2)stale_claim_timeout_minutesconstructor parameter (set to 0 to disable)Root cause (from #991)
→ never reclaimed → per-bank serialization blocks new work → bank permanently wedged
Manual
UPDATE ... SET status='pending' WHERE worker_id='<dead>'immediately unblocks the bank (confirmed by reporter).Fixes #991