Repository navigation
fix(runtime): transition silo status before grain deactivation - #10294
Merged
ReubenBond merged 3 commits intoJul 21, 2026
Merged
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts the silo shutdown lifecycle so membership state is published before grain deactivation begins, and keeps the distributed grain directory available long enough for shutdown-triggered grain migrations to complete. Adds a regression test covering PreferLocalPlacement grains migrating during shutdown, including a delayed membership-status publication and directory-ownership handoff timing.
Changes:
- Introduces new lifecycle stages (
GrainDeactivation,GrainDirectoryShutdown) to refine shutdown ordering. - Moves silo grain deactivation to the new stage and delays distributed grain directory shutdown until migrations are done.
- Adds/updates tests to validate lifecycle ordering and distributed directory migration behavior; updates Orleans.Core public API surface accordingly.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.GrainDirectory.Tests/GrainDirectory/GrainDirectoryShutdownMigrationTests.cs | New regression test for prefer-local grain migration during shutdown and directory handoff timing. |
| test/Orleans.Core.Tests/Membership/MembershipAgentTests.cs | Updates lifecycle-stage assertions to account for the new shutdown stage. |
| src/Orleans.Runtime/Silo/Silo.cs | Moves grain deactivation work to the new GrainDeactivation stage. |
| src/Orleans.Runtime/GrainDirectory/DistributedGrainDirectory.cs | Delays directory shutdown to GrainDirectoryShutdown so migrations can complete. |
| src/Orleans.Core/Lifecycle/ServiceLifecycleStage.cs | Adds new lifecycle stage constants used to control shutdown ordering. |
| src/api/Orleans.Core/Orleans.Core.cs | Updates generated public API surface with the new lifecycle constants. |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 2
Contributor
There was a problem hiding this comment.
Copilot's findings
Comments suppressed due to low confidence (1)
test/Orleans.GrainDirectory.Tests/GrainDirectory/GrainDirectoryShutdownMigrationTests.cs:108
ViewUpdates.WithCancellation(cancellationToken)will throwOperationCanceledExceptionwhen the timeout token is canceled, so this method will typically fail with an OCE and the finalTimeoutExceptionwill never be thrown. Catch the cancellation and rethrow aTimeoutException(as done in other directory tests) so failures are deterministic and have a useful message.
await foreach (var view in membershipService.ViewUpdates.WithCancellation(cancellationToken))
{
if (expectedMembers.SetEquals(view.Members))
{
return;
- Files reviewed: 6/6 changed files
- Comments generated: 0 new
Publish the ShuttingDown membership state before grain deactivation and keep the distributed grain directory available until shutdown migrations complete. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dd8b146c-c118-4d86-b2d1-c9f3b97bd8ea
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Translate membership wait cancellation into an actionable timeout and end the artificial membership delay promptly without skipping status publication. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: dd8b146c-c118-4d86-b2d1-c9f3b97bd8ea
ReubenBond
force-pushed
the
reubenbond-fix-shutdown-grain-migration
branch
from
July 21, 2026 17:52
c7913c0 to
2dd0198
Compare
This was referenced Jul 22, 2026
This was referenced Jul 29, 2026
This was referenced Jul 29, 2026
Merged
This was referenced Aug 5, 2026
This was referenced Aug 18, 2026
Closed
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.
Grains using
PreferLocalPlacementcould select the shutting-down silo whenMigrateOnIdle()was called fromOnDeactivateAsync, because membership status publication and grain deactivation ran concurrently.This changes the shutdown lifecycle ordering so the silo publishes
ShuttingDownbefore grain deactivation begins, then keeps the distributed grain directory available until shutdown-triggered migrations complete. It also adds a two-silo regression test which covers migrations both before and during asynchronous directory ownership handoff.Microsoft Reviewers: Open in CodeFlow