GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(directory): cancel snapshot pulls from departed silos by ReubenBond · Pull Request #10318 · dotnet/orleans

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 1, 2026 •
edited by dotnet-policy-service Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

During an in-place rolling upgrade, a distributed directory partition could begin pulling a snapshot from the retiring owner while that silo transitioned from ShuttingDown to Dead. Snapshot pulls were the one per-member directory operation not bound to the membership-driven cancellation token, so the acquisition range lock remained held until the 30-second messaging timeout. Local lookups for that range queued behind the lock and timed out as a result.

This change plumbs the shared member cancellation token through GetSnapshotAsync and range waits. When the previous owner departs, the snapshot pull now stops immediately and the existing recovery path takes over. Callee shutdown remains linked into the wait, and diagnostics distinguish an unavailable owner from an invalid snapshot.

Microsoft Reviewers: Open in CodeFlow

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
fix(directory): cancel snapshot pulls from departed silos
1f3a79c
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 6b23a814-ee05-48e1-bd7b-9b304a409b25
Copilot AI review requested due to automatic review settings August 1, 2026 01:20
Copilot started reviewing on behalf of ReubenBond August 1, 2026 01:21
View session
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This PR improves Orleans distributed grain directory resilience during rolling upgrades by ensuring snapshot-pull operations are canceled promptly when the previous owner silo departs, preventing prolonged range-lock holds and downstream lookup timeouts.

Changes:

  • Plumbs a membership-driven CancellationToken through IGrainDirectoryPartition.GetSnapshotAsync to allow snapshot pulls to cancel when the previous owner becomes unavailable.
  • Updates range-wait logic (WaitForRange) to support cancellation during lock waits and view refresh.
  • Improves diagnostics to distinguish “previous owner unavailable” from “invalid/missing snapshot”.
Show a summary per file
File Description
src/Orleans.Runtime/GrainDirectory/LocalGrainDirectoryCompatibility.cs Updates the compatibility system target to accept and honor a cancellation token for snapshot requests.
src/Orleans.Runtime/GrainDirectory/IGrainDirectoryPartition.cs Extends the partition system-target contract to include an optional CancellationToken for snapshot pulls.
src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs Links caller cancellation into snapshot acquisition and range waits; routes snapshot pulls via member-cancellable invocation and refines warning logs.

Copilot's findings

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ReubenBond
fix(directory): cancel partition RPCs
02cc1bc
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 6b23a814-ee05-48e1-bd7b-9b304a409b25
Copilot AI review requested due to automatic review settings August 1, 2026 02:46
Copilot started reviewing on behalf of ReubenBond August 1, 2026 02:46
View session
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Suppressed comments (2)

src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs:109

  • This post-wait cancellation check only observes ShutdownToken. If the caller-provided cancellationToken is canceled after WaitForRange completes (but before snapshot construction), this method will continue building the snapshot unnecessarily. Since you already created a linked token, use that for the final ThrowIfCancellationRequested check.
        ShutdownToken.ThrowIfCancellationRequested();

src/Orleans.Runtime/GrainDirectory/GrainDirectoryPartition.cs:582

  • This snapshot pull is no longer bound to the local partition ShutdownToken. Previously the call used WaitAsync(ShutdownToken), ensuring the range-lock acquisition path could abort promptly during local shutdown; now InvokeOnClusterMember waits solely on the remote member token and can block until the messaging timeout if this silo is stopping.
                var snapshot = await InvokeOnClusterMember(
                    previousOwner,
                    cancellationToken => partition.GetSnapshotAsync(
                        current.Version,
                        previousVersion,
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
fix(directory): honor snapshot request cancellation
51d4da3
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 6b23a814-ee05-48e1-bd7b-9b304a409b25
Copilot AI review requested due to automatic review settings August 1, 2026 04:27
Copilot started reviewing on behalf of ReubenBond August 1, 2026 04:27
View session
Copilot AI reviewed Aug 1, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Suppressed comments (1)

src/Orleans.Runtime/GrainDirectory/DistributedGrainDirectory.cs:190

  • InvokeAsync links the per-request token with GetClusterMemberCancellationToken(owner). If the token cache has not yet been updated for the selected owner (e.g., after a RefreshViewAsync returns a newer view but before ProcessMembershipUpdates calls _clusterMemberCancellationTokens.Update for that snapshot), GetToken returns a pre-canceled token and the call is immediately canceled/retried (and can fail after MaxAttempts). Consider lazily seeding/updating the token cache when the latest membership snapshot still considers the owner invokable.
                RequestContext.Set("gid", partitionReference.GetGrainId());
                using var requestCts = CancellationTokenSource.CreateLinkedTokenSource(
                    cancellationToken,
                    GetClusterMemberCancellationToken(owner));
                invokeResult = await func(partitionReference, view.Version, state, requestCts.Token);
  • Files reviewed: 5/5 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
ReubenBond merged commit c925aa7 into dotnet:main Aug 1, 2026
66 of 67 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ReubenBond
ReubenBond deleted the reubenbond-investigate-grain-directory-hang branch August 1, 2026 06:01
This was referenced Aug 28, 2026
Bump Microsoft.Orleans.Dashboard from 10.2.2 to 10.3.0 csrakowski/FeedManager#20
Merged
Bump Microsoft.Orleans.Persistence.AdoNet from 10.2.2 to 10.3.0 csrakowski/FeedManager#21
Merged
Bump Microsoft.Orleans.Persistence.Memory from 10.2.2 to 10.3.0 csrakowski/FeedManager#22
Closed
Bump Microsoft.Orleans.Persistence.Redis from 10.2.2 to 10.3.0 csrakowski/FeedManager#23
Merged
Bump Microsoft.Orleans.Runtime from 10.2.2 to 10.3.0 csrakowski/FeedManager#24
Merged
Bump Microsoft.Orleans.Sdk from 10.2.2 to 10.3.0 csrakowski/FeedManager#25
Merged
Bump Microsoft.Orleans.Persistence.Memory and Microsoft.Orleans.Server csrakowski/FeedManager#26
Merged
Bump the dotnet-dependencies group with 1 update dills122/sandtable#67
Merged
Bump the dotnet group with 2 updates Kuestenlogik/Surgewave.Connectors#20
Merged
chore(deps): Bump the nuget-patch-and-minor group with 13 updates petesramek/microservices-vs-virtual-actors#7
Closed
chore: Bump Microsoft.Orleans.Persistence.Memory and Microsoft.Orleans.Runtime managedcode/Communication#151
Closed
chore: Bump Microsoft.Orleans.Runtime from 10.2.2 to 10.3.1 managedcode/Communication#152
Closed
chore: Bump Microsoft.Orleans.Sdk from 10.2.2 to 10.3.1 managedcode/Communication#153
Closed
chore: Bump Microsoft.Orleans.Serialization.Abstractions from 10.2.2 to 10.3.1 managedcode/Communication#154
Merged
chore: Bump Microsoft.Orleans.Persistence.Memory and 3 others managedcode/Communication#155
Closed
chore: Bump Microsoft.Orleans.TestingHost from 10.2.2 to 10.3.1 managedcode/Communication#156
Merged
@dependabot dependabot Bot mentioned this pull request Aug 31, 2026
Bump the orleans group with 1 update vgmello/momentum#341
Closed
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ReubenBond
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.