Skip to content

test(streaming): investigate ServiceId_SiloRestart shutdown timeout on Windows net10 #11286

Closed

Description

@ReubenBond

Observed failure

UnitTests.Streaming.StreamProvidersTests_ProviderConfigNotLoaded.ServiceId_SiloRestart failed during graceful silo shutdown on Windows/.NET 10 after 30.710 seconds:

System.Threading.Tasks.TaskCanceledException : A task was canceled.
   at Orleans.Runtime.Silo.StopAsync(CancellationToken cancellationToken)
      in src/Orleans.Runtime/Silo/Silo.cs:line 328
   at Orleans.Hosting.SiloHostedService.StopAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StopAsync(CancellationToken cancellationToken)
   at Orleans.TestingHost.InProcessSiloHandle.StopSiloAsync(CancellationToken ct)
      in src/Orleans.TestingHost/InProcessSiloHandle.cs:line 110
   at Orleans.TestingHost.TestCluster.StopSiloAsync(...)
   at Orleans.TestingHost.TestCluster.RestartSiloAsync(SiloHandle instance)
      in src/Orleans.TestingHost/TestCluster.cs:line 843
   at UnitTests.Streaming.StreamProvidersTests_ProviderConfigNotLoaded.ServiceId_SiloRestart()
      in test/Orleans.Streaming.Tests/StreamingTests/StreamProvidersTests.cs:line 98

Output reaches Restarting Silos ..., then shutdown exhausts its budget before the service-ID checks can finish.

Evidence and scope

Expected behavior

Each silo completes graceful shutdown and restarts within the fixture's existing lifetime budget; every restarted silo reports the configured service ID.

Investigation

Identify the lifecycle observer or shutdown operation still outstanding when the 30-second host budget expires, and reproduce the complete fixture on Windows/.NET 10 before changing timeouts. Preserve the cancellation exception as evidence rather than suppressing it.

Previous issues #4721 and #4997 concern the same test name but describe a five-minute startup membership-activation timeout in older runtime versions. This report tracks the distinct current shutdown cancellation signature.

Activity

  1. ReubenBond commented on Sep 17, 2026

    @ReubenBond
    MemberAuthor

    Investigation result: the 30-second budget is consumed by the silo's GrainDeactivation lifecycle observer, not by a later connection/observer/stream shutdown stage.

    The failing artifact from run 35160511003, Windows net10 Functional job 105009940037 shows:

    • Orleans.Runtime.Silo completes stage GrainDeactivation (19998) only after 00:00:29.9918544, with Some grains failed to deactivate promptly when cancellation arrives.
    • The subsequent GrainDirectoryShutdown, dissemination, and runtime-stage errors begin after cancellation and are fallout.
    • The test exception remains TaskCanceledException from Silo.StopAsync through Host.StopAsync and RestartSiloAsync, preserving the shutdown cancellation evidence.

    The only application activation on that silo is the Streaming_ConsumerGrain left by ProvidersTests_ConfigNotLoaded in the shared fixture. Its OnDeactivateAsync logs immediately and returns Task.CompletedTask; Grain<TState> also has a no-op lifecycle stop. The remaining deactivation path is therefore the grain-directory unregister before ActivationData.Deactivated can be signaled:

    Catalog.DeactivateAllActivations -> ActivationData.FinishDeactivating -> CachedGrainLocator.Unregister -> DistributedGrainDirectory.UnregisterAsync/InvokeAsync -> DirectoryMembershipService.RefreshViewAsync -> ClusterMembershipService.Refresh.

    TestClusterBuilder configures the distributed grain directory, so the legacy DhtGrainLocator batch path is not involved. During the stall, the same silo reports that the development membership table version decreased from 10 to 2 and its prior incarnation is no longer authoritative, while traffic continues toward superseded silo incarnations. The distributed-directory operation can then wait for a membership/directory view version which the recreated development table has not reached. Both the activation deactivation timeout and test-host shutdown timeout are 30 seconds, leaving no margin once that view refresh stops converging.

    The recent shutdown PRs do not establish a fix for this occurrence:

    The pending post-rebase run 35161569496 passed this test in 0.646 seconds on Windows/net10 at ac97ebb69d; three later #10236 Windows/net10 Functional jobs also passed. A targeted run from current main passed 1/1. Since the relevant path is unchanged between the failed and immediate passing PR heads, these passes demonstrate intermittency rather than a causal fix.

    This signature is tied to #10236's development-membership reset/distributed-directory convergence path. A deterministic regression should hold an unregister across a development-table reset and record the requested, current cluster, and current directory view versions. That gives a bounded place to correct convergence while retaining cancellation evidence. I found no evidence supporting a timeout increase, suppression, or a separate standalone patch, so I am leaving the issue open with this trace rather than opening a workaround PR.

  2. ReubenBond commented on Sep 18, 2026

    @ReubenBond
    MemberAuthor

    Verified fixed by #11294, with the end-to-end gap now covered by post-merge CI.

    Root cause: when the development membership table was recreated during the sequential silo restart, SystemTargetBasedMembershipTable raised a fatal silo error. TestClusterFatalErrorHandler then called host.StopAsync() with a live token, so the lost process incarnation attempted a graceful drain against unreachable/superseded peers. That drain consumed the 30-second host budget and surfaced TaskCanceledException from Silo.StopAsync in this test.

    #11294 changes the fatal-error path to call host.StopAsync with a pre-canceled token. The silo therefore performs bounded non-graceful lifecycle cleanup instead of waiting for remote drain progress, while cancellation remains classified separately from actual stop failures.

    Concrete post-merge evidence:

    • The merge-commit Windows/net10 Functional job passed: run 35239220678, job 105263005034. ServiceId_SiloRestart passed and printed ..... Silos restarted.
    • Four consecutive post-merge main Windows/net10 Functional artifacts passed this test: 31.150s, 31.060s, 30.906s, then 1.063s.
    • The decisive run is 35279197239, job 105396961615, after fix(membership): preserve canonical membership views #11296 brought the fatal development-table rollback policy to main. During ServiceId_SiloRestart, the logs reproduce the original stimulus on the three remaining silos: membership version decreases 10→2, 10→4, and 10→6, each reported by TestClusterFatalErrorHandler.
    • Despite those fatal errors, each affected silo begins stopping immediately; for the 10→2 silo, the fatal notification is logged at 22:05:48.289 and Orleans Silo stopped at 22:05:48.318. The test passes in 1.063s and prints ..... Silos restarted, instead of exhausting the 30-second budget.
    • feat(runtime): add deterministic dissemination broadcast and repair #10236's latest Windows/net10 Functional run provides independent corroboration with the same 10→2/4/6 fatal rollback signature and a passing ServiceId_SiloRestart in 2.405s: run 35283720779, job 105411255555.

    No additional runtime or test timeout change is needed. Closing as completed by #11294; #11296 supplied the mainline scenario needed to prove the fix end to end.

  3. locked and limited conversation to collaborators on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions