Replace terminated threads even if releasing their claimed jobs fails - #791
Merged
Conversation
The async supervisor had the same hole #781 closed for forks: a worker thread that dies when the database is unreachable — likely the very reason it died — took the whole supervise loop down with it when replace_thread tried to fail its claimed jobs before starting the replacement. Hoist the rescued release into the Maintenance concern both supervisors share, and let callers pass the error, since forks and threads terminate with different ones. As with forks, the terminated thread's claimed jobs aren't lost by skipping the release: its stale registration is pruned once the database is reachable again, and pruning fails its claimed executions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The async supervisor has the same hole #781 closed for forks: a worker thread that dies when the database is unreachable — likely the very reason it died — takes the whole supervise loop down with it when
replace_threadtries to fail its claimed jobs before starting the replacement, leaving the supervisor permanently dead with a growing backlog, as in #683.This hoists #781's rescued release into the
Maintenanceconcern both supervisors share, with callers passing the error since forks and threads terminate with different ones, and uses it fromreplace_thread. As with forks, the terminated thread's claimed jobs aren't lost by skipping the release: its stale registration is pruned once the database is reachable again, and pruning fails its claimed executions through the normal path.🤖 Generated with Claude Code