Conversation
noise64
approved these changes
Mar 19, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Trying to fix flakyness of the
invoking_worker_while_its_getting_deleted_workstest case.Changes:
FinalWorkerStateenum — encodes whether a stop should end inUnloaded(restartable) orDeleting(terminal)StoppingWorkernow carriesfinal_state— so during shutdown, the intended destination is locked in while the mutex is heldstop_internal/stop_internal_lockedacceptfinal_state— if a delete arrives while already stopping, it upgrades the final state toDeletinghandle_stop_resultreadsfinal_statefrom the currentStoppingWorkerinstead of hardcodingUnloadedstart_deletingsimplified — just callsstop_internal(..., FinalWorkerState::Deleting)directlyThe behavior that changes:
Before: Delete → stop worker → release lock → re-acquire → see Unloaded — but the invoke loop can grab the lock in that gap and restart from Unloaded
After: Delete → Stopping { final_state: Deleting } set while holding the lock → lock_non_stopping_worker() blocks invokers during shutdown → loop exits → handle_stop_result finalizes to Deleting → invokers wake up, see Deleting, and fail.