Stop PlacementService workers during shutdown#9993
Merged
ReubenBond merged 1 commit intoApr 28, 2026
Conversation
b009dcc to
f4b7289
Compare
f4b7289 to
0eea53b
Compare
1de0ef3 to
523bdcd
Compare
4fd88c2 to
32d25d9
Compare
This was referenced Apr 27, 2026
Register PlacementService with the silo lifecycle so placement workers are signaled and awaited during shutdown. Reject new placement work once shutdown begins and expose diagnostics for focused regression tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
32d25d9 to
36b29f9
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 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.
Fixes #9827.
Why
PlacementServicestarts background worker loops but did not participate in the silo lifecycle. During shutdown those workers could continue into placement resolution and touch keyed services after the silo was already stopping, which could surface the loggedObjectDisposedExceptionfromIServiceProviderdisposal.What changed
PlacementServiceas anISiloLifecycleparticipant and stop it atServiceLifecycleStage.RuntimeInitialize + 1Notes
This fixes the lifetime mismatch directly instead of catching and suppressing
ObjectDisposedExceptionin the worker loop.Validation
dotnet build Orleans.slnx -nologodotnet test test\\Orleans.Core.Tests\\Orleans.Core.Tests.csproj -nologo --filter "FullyQualifiedName~PlacementServiceTests"Microsoft Reviewers: Open in CodeFlow