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 — test: observe grain directory convergence in liveness tests by ReubenBond · Pull Request #10299 · dotnet/orleans

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Jul 22, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Liveness_Grain_4_Kill_Silo_1_With_Timers can fail immediately after WaitForLivenessToStabilizeAsync returns because membership-status convergence and grain-directory convergence are handled by separate asynchronous consumers.

The existing stabilization helper waits until each silo's ISiloStatusOracle excludes the killed silo. The grain directory independently consumes membership changes to remove registrations and cache entries for activations on dead silos. The status event can therefore complete the helper just before the directory applies the same membership version, allowing the next grain call to route to a stale activation and time out.

This change keeps convergence tracking entirely outside the runtime directory implementations:

  • LocalGrainDirectory emits a diagnostic after applying a membership snapshot and purging stale directory/cache entries.
  • GrainDirectoryPartition emits a diagnostic after observing a membership view; its existing range-operation start/completion diagnostics describe asynchronous range transitions.
  • GrainDirectoryObserver, owned by in-process test clusters and subscribed before silos start, tracks those events and pending range operations externally.
  • Liveness stabilization waits for the observer between silo-status and gateway convergence when all silo service providers are available in-process.

DistributedGrainDirectory retains its original behavior and has no additional state or task tracking. There are no fixed delays, polling loops, or grain-call retries.

Sorry, something went wrong.

Uh oh!

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

All reactions
@ReubenBond
test: retry post-recovery grain calls in liveness tests
049d2b4
Liveness_Grain_4_Kill_Silo_1_With_Timers (and related hard-kill
liveness tests) can spuriously fail with a TimeoutException right
after killing a silo.

WaitForLivenessToStabilizeAsync computes a wait based on
ProbeTimeout * NumMissedProbesLimit, but ClusterMembershipOptions.
ExtendProbeTimeoutDuringDegradation (enabled by default) adaptively
extends probe timeouts under local health degradation, which is
common on loaded CI machines. This makes the actual failure
detection + directory convergence time exceed the test's
precomputed wait, so the very next grain call can hit the 30s
response timeout before the cluster finishes reacting to the kill.

Retry transient TimeoutExceptions for the post-recovery traffic in
Do_Liveness_OracleTest_2, bounded by a 60s window, so the test
tolerates slow convergence without weakening its assertions.
Copilot AI review requested due to automatic review settings July 22, 2026 15:37
@azure-pipelines

azure-pipelines Bot commented Jul 22, 2026

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.
All reactions

Sorry, something went wrong.

Uh oh!

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

Copilot started reviewing on behalf of ReubenBond July 22, 2026 15:38
View session
Copilot AI reviewed Jul 22, 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 the reliability of Orleans liveness/membership tests by retrying post-recovery grain calls which can transiently time out after a hard silo kill (where failure detection and directory convergence are timing-sensitive under CI load).

Changes:

  • Wrap post-recovery grain traffic in Do_Liveness_OracleTest_2 with a retry-on-timeout helper.
  • Add SendTrafficWithRetry to tolerate transient TimeoutExceptions for a bounded period after kill/restart.
  • Add System.Diagnostics usage for retry window timing.
Show a summary per file
File Description
test/Orleans.Runtime.Tests/MembershipTests/LivenessTests.cs Adds bounded retry logic around post-recovery grain calls to reduce spurious liveness test failures under load.

Copilot's findings

Comments suppressed due to low confidence (1)

test/Orleans.Runtime.Tests/MembershipTests/LivenessTests.cs:186

  • To support a shared retry window across all post-recovery grain calls, SendTrafficWithRetry should accept the caller's Stopwatch/window instead of starting a new one per call. This prevents multiplying the retry budget by the number of grains.
        private async Task SendTrafficWithRetry(long key, bool startTimers = false)
        {
            var stopwatch = Stopwatch.StartNew();
            var retryWindow = TimeSpan.FromSeconds(60);
            while (true)
  • Files reviewed: 1/1 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 test/Orleans.Runtime.Tests/MembershipTests/LivenessTests.cs Resolved

Uh oh!

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

@ReubenBond
test: await grain directory convergence
6d093e0
Wait for LocalGrainDirectory to apply the membership version observed by each active silo before liveness stabilization completes. The version signal is published after stale directory and cache entries are removed, closing the race between silo-status convergence and grain routing without polling, sleeps, or call retries.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
@ReubenBond ReubenBond changed the title test: retry post-recovery grain calls in liveness tests test: await grain directory convergence in liveness tests Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 15:57
Copilot started reviewing on behalf of ReubenBond July 22, 2026 15:58
View session
Copilot AI reviewed Jul 22, 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

Comments suppressed due to low confidence (1)

src/Orleans.TestingHost/LivenessStabilizationHelper.cs:56

  • WaitForExpectedActiveSilosAsync can now wait up to timeout for ISiloStatusOracle convergence and then wait up to another full timeout for grain-directory cleanup, so this method can exceed its timeout parameter. If timeout is intended as an overall bound (as implied by callers), consider using the remaining time budget for the grain-directory phase.
            waitTasks = testHooks.Select(hooks => hooks.WaitForGrainDirectoryMembershipVersion(timeout));
            results = await Task.WhenAll(waitTasks).WaitAsync(timeout);
            return results.All(static result => result);
  • Files reviewed: 4/4 changed files
  • Comments generated: 3

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/Orleans.TestingHost/LivenessStabilizationHelper.cs Resolved

Uh oh!

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

Comment thread src/Orleans.TestingHost/LivenessStabilizationHelper.cs Resolved

Uh oh!

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

Comment thread src/Orleans.Runtime/Silo/TestHooks/TestHooksSystemTarget.cs Resolved

Uh oh!

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

@ReubenBond
test: observe grain directory convergence events
a33c878
Emit membership-version-applied diagnostics after local directory cleanup and after distributed partition transitions complete. Test hooks subscribe to the aggregate directory event using a check-subscribe-check pattern instead of calling a waiter on LocalGrainDirectory.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
Copilot AI review requested due to automatic review settings July 22, 2026 19:13
Copilot started reviewing on behalf of ReubenBond July 22, 2026 19:14
View session
Copilot AI reviewed Jul 22, 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

Comments suppressed due to low confidence (2)

src/Orleans.TestingHost/LivenessStabilizationHelper.cs:29

  • WaitForLivenessToStabilizeAsync logs that it is waiting "up to" the provided timeout, but this helper no longer tracks elapsed time. Since subsequent waits use the full timeout again, the overall stabilization wait can exceed the caller-provided budget, slowing/derailing tests.
    public static async Task<bool> WaitForExpectedActiveSilosAndGatewaysAsync(
        IReadOnlyCollection<SiloHandle> activeSilos,
        IReadOnlyCollection<ITestHooks> testHooks,
        GatewayManager gatewayManager,
        TimeSpan timeout)
    {
        ArgumentNullException.ThrowIfNull(gatewayManager);

        if (!await WaitForExpectedActiveSilosAsync(activeSilos, testHooks, timeout))
        {
            return false;
        }

        return await WaitForExpectedActiveGatewaysAsync(activeSilos, gatewayManager, timeout);
    }

src/Orleans.TestingHost/LivenessStabilizationHelper.cs:56

  • This method now performs two separate waits (liveness oracle convergence, then grain-directory convergence) each with the full timeout, so it can take up to ~2× the intended stabilization budget. Consider accounting for elapsed time before starting the second phase so the method honors the provided overall timeout.
        try
        {
            var waitTasks = testHooks.Select(hooks => hooks.WaitForActiveSilos(expectedActiveSilos, timeout));
            var results = await Task.WhenAll(waitTasks).WaitAsync(timeout);
            if (!results.All(static result => result))
            {
                return false;
            }

            waitTasks = testHooks.Select(hooks => hooks.WaitForGrainDirectoryMembershipVersion(timeout));
            results = await Task.WhenAll(waitTasks).WaitAsync(timeout);
            return results.All(static result => result);
  • Files reviewed: 7/7 changed files
  • Comments generated: 2

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread src/Orleans.TestingHost/LivenessStabilizationHelper.cs Resolved

Uh oh!

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

Comment thread src/Orleans.Runtime/Silo/TestHooks/TestHooksSystemTarget.cs Resolved

Uh oh!

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

@ReubenBond
test: track directory convergence outside runtime
b6356c8
Keep grain directory runtime behavior unchanged and emit only local-applied and partition-observed diagnostics. In-process test clusters subscribe before silo startup and track membership versions plus existing range-operation lifetimes externally, allowing liveness stabilization to await directory convergence without runtime task tracking or state.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
@ReubenBond ReubenBond changed the title test: await grain directory convergence in liveness tests test: observe grain directory convergence in liveness tests Jul 22, 2026
Copilot AI review requested due to automatic review settings July 22, 2026 20:28
Copilot started reviewing on behalf of ReubenBond July 22, 2026 20:29
View session
Copilot AI reviewed Jul 22, 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

Comments suppressed due to low confidence (2)

src/Orleans.TestingHost/LivenessStabilizationHelper.cs:33

  • timeout is reused for the silo-status wait, grain-directory convergence wait, and gateway convergence wait, so the overall stabilization can exceed the intended timeout. Track elapsed time and pass the remaining time to each subsequent stage.
        if (waitForGrainDirectoryConvergence is not null
            && !await waitForGrainDirectoryConvergence(timeout))
        {
            return false;
        }

src/Orleans.TestingHost/LivenessStabilizationHelper.cs:49

  • When activeSilos.Count == 0, this helper returns immediately without waiting, even though callers/logging treat it as a stabilization wait. This was previously a delay for the full timeout; consider keeping that behavior to avoid surprising fast-fail paths.
        if (activeSilos.Count == 0)
        {
            return false;
        }
  • Files reviewed: 7/7 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
test: preserve liveness stabilization timeout
ca75d29
Use a single timeout budget across silo-status, grain-directory, and gateway convergence, and preserve the existing fallback delay when no active silos are available.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
Copilot AI review requested due to automatic review settings July 31, 2026 16:36
Copilot started reviewing on behalf of ReubenBond July 31, 2026 16:36
View session
Copilot AI reviewed Jul 31, 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

  • Files reviewed: 7/7 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.TestingHost/InProcTestCluster.cs Resolved

Uh oh!

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

@ReubenBond
test: skip unsupported directory diagnostics
a6f0a10
Do not await runtime grain-directory diagnostics when InProcessTestCluster uses its custom InProcessGrainDirectory, which does not emit those events.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
Copilot AI review requested due to automatic review settings July 31, 2026 17:16
Copilot started reviewing on behalf of ReubenBond July 31, 2026 17:17
View session
Copilot AI reviewed Jul 31, 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

  • Files reviewed: 7/7 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
test: skip unobservable grain directories
8483692
Only enable directory convergence observation when each silo uses the built-in local or distributed directory. External default directory implementations do not emit the required diagnostics, so retain the existing liveness stabilization path for those clusters.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 965b2b7b-61b4-474d-ac47-bec64d97ff6c
Copilot AI review requested due to automatic review settings July 31, 2026 17:24
Copilot started reviewing on behalf of ReubenBond July 31, 2026 17:29
View session
Copilot AI reviewed Jul 31, 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

  • Files reviewed: 7/7 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 cc331e5 into main Jul 31, 2026
69 of 70 checks passed

Uh oh!

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

@ReubenBond
ReubenBond deleted the reubenbond-fix-liveness-test-flakiness branch July 31, 2026 18:13
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
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.