Skip to content

fix: allow local activation migration#10218

Draft
ReubenBond wants to merge 1 commit into
dotnet:mainfrom
ReubenBond:reubenbond/local-silo-migration-flow
Draft

fix: allow local activation migration#10218
ReubenBond wants to merge 1 commit into
dotnet:mainfrom
ReubenBond:reubenbond/local-silo-migration-flow

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Jun 11, 2026

Copy link
Copy Markdown
Member

Activation migration could deadlock or skip the regular flow when placement selected the local silo, because the replacement activation could not be created until the old activation was removed from the local catalog.

This change lets migration to the local silo still dehydrate first, then defers the local handoff until after UnregisterMessageTarget() removes the old activation from the catalog. The migration manager accepts same-silo handoffs directly, and the migration APIs/docs no longer imply that same-silo placement is ignored.

A regression test forces migration back to the current silo and verifies that a new activation is created on the same silo with migrated state preserved.

Microsoft Reviewers: Open in CodeFlow

@ReubenBond ReubenBond marked this pull request as draft June 11, 2026 23:29
@ReubenBond ReubenBond requested a review from Copilot June 11, 2026 23:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes activation migration behavior when placement selects the current silo by deferring the “local handoff” until after the old activation is removed from the local catalog, preventing deadlocks/skipped migration flow. Also updates migration docs to reflect that same-silo placement is a valid migration destination and adds a regression test.

Changes:

  • Allow ActivationMigrationManager to accept same-silo migration requests directly.
  • Update deactivation/migration flow to dehydrate first, unregister the old activation from the local catalog, then complete migration for same-silo handoffs.
  • Add a regression test which forces migration back to the current silo and validates state preservation across the new activation.
Show a summary per file
File Description
test/Orleans.DefaultCluster.Tests/Migration/MigrationTests.cs Adds a regression test for same-silo activation migration and state preservation.
src/Orleans.Runtime/Catalog/ActivationMigrationManager.cs Allows same-silo migration by directly invoking AcceptMigratingGrains.
src/Orleans.Runtime/Catalog/ActivationData.cs Defers same-silo migration completion until after UnregisterMessageTarget() removes the old activation from the catalog.
src/Orleans.Core.Abstractions/Core/Internal/IGrainManagementExtension.cs Updates XML docs to not imply migration requires a new location.
src/Orleans.Core.Abstractions/Core/IGrainBase.cs Updates XML docs to describe migration destination selection more accurately.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 1

Comment on lines +132 to +136
do
{
cts.Token.ThrowIfCancellationRequested();
newAddress = await grain.GetGrainAddress();
} while (newAddress.ActivationId == originalAddress.ActivationId);
Ensure activation migration to the local silo still follows the normal dehydrate/rehydrate flow while deferring the local handoff until after the old activation is removed from the catalog.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ReubenBond ReubenBond force-pushed the reubenbond/local-silo-migration-flow branch from 0a3cd12 to 0eba386 Compare June 12, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants