fix(runtime): synchronize version selector cache generations - #10597
Merged
ReubenBond merged 2 commits intoAug 14, 2026
Merged
ReubenBond merged 2 commits into
ReubenBond merged 2 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Orleans runtime grain-version selection caching to avoid returning stale silo selections across cluster topology/manifest changes by synchronizing cached reads against both cluster manifest and membership versions.
Changes:
- Reworks
CachedVersionSelectorManagercaching to use a unified cache generation and adds a membership-alignedGetSupportedSilos(GrainType)method. - Updates/extends unit tests to validate cache refresh behavior across membership + manifest updates and manifest minor version changes.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Core.Tests/Manifest/ClusterManifestProviderTests.cs | Extends tests to cover membership-aligned version-selector cache refresh and manifest minor-version refresh behavior. |
| src/Orleans.Runtime/Versions/CachedVersionSelectorManager.cs | Replaces concurrent cache with generation-validated cache reads, adds membership-aware supported-silo reads, and updates reset/invalidations behavior. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
src/Orleans.Runtime/Versions/CachedVersionSelectorManager.cs:95
- This retry loop can also spin aggressively under transient manifest/membership/generation changes. Consider yielding/backing off between retries to prevent unnecessary CPU usage.
lock (this.cacheLock)
{
var current = ObserveCacheState();
if (current.Generation == state.Generation
&& resultVersion == current.ManifestVersion
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0958d7d-4e8a-4ea8-b38b-5eb05529c312
This was referenced Aug 14, 2026
This was referenced Aug 14, 2026
This was referenced Aug 28, 2026
Merged
This was referenced Sep 3, 2026
This was referenced Sep 14, 2026
Open
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.
Cached version selector results can otherwise be computed and retained across different cluster manifest and membership generations, allowing stale silo selections during topology changes.
This change synchronizes selector reads with both membership and manifest versions using a unified cache generation, refreshes results when either generation changes, and adds a membership-aligned
GetSupportedSilospath.The existing
CacheInvalidatedevent is intentionally retained and raised after the generation advances because the currentPlacementServicestill subscribes to it. The follow-up placement integration will remove that compatibility event.Microsoft Reviewers: Open in CodeFlow