Conversation
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.
Motivation
If a runner dies while tasks are in flight (in my case an MLX runner aborting with signal 6 on a Metal out-of-memory error),
RunnerSupervisor._check_runnersends anErrorChunkfor each task inin_progress. Each send is awaited, and in the meantime_forward_eventscan pop a task whoseTaskStatusUpdatedComplete just arrived. The loop then raisesRuntimeError: dictionary changed size during iteration, the task group fails, and the whole process exits instead of just reporting the failed runner.Related to #2176. #2177 also snapshots the dict, but would still send an
ErrorChunkfor a task that already completed.Changes
_check_runneriterates a snapshot ofin_progressand skips any task that completed while an earlier chunk was being sent.Why It Works
Pops and inserts during the awaited sends can no longer invalidate the iteration, and the membership check avoids emitting an error for a command whose completion was already forwarded.
Test Plan
Manual Testing
Hit the crash after a runner was killed by a Metal OOM abort with requests in flight; the process exited with "EXO terminated due to unhandled exception".
Automated Testing
test_check_runner_survives_task_completing_during_error_fanout: two text generation tasks in flight, the second completes during the first one's error send. It fails on main with theRuntimeErrorand passes with this change.