Repository navigation
fix(reminders): order topology reconciliation admission - #11118
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new private protected access modifier on SubscribeToRangeChangeEvents prevents LocalReminderService (in a different assembly) from calling it, and the initial-load loop should drain queued range-change turns before deciding the range stayed stable.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Lite
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/Services/GrainService.cs — SubscribeToRangeChangeEvents is declared private protected, which makes it inaccessible to… |
|
src/Orleans.Reminders/ReminderService/LocalReminderService.cs — The initial-load retry loop only compares RangeSerialNumber before/after… |
What changed in this PR
This PR updates Orleans reminder-service topology stabilization to avoid redundant provider refreshes in tests and to make reminder-service startup readiness robust against ring range changes during the initial load, addressing recent flaky timeout scenarios in reminder lifecycle tests.
Changes:
- Removes the “all-silo explicit refresh” from
ReminderTopologyStabilizerand instead uses a FIFO scheduler boundary plus the existing reconciliation-generation barrier. - Updates
LocalReminderServicestartup to subscribe to ring changes before the initial read and to repeat the initial load when the owned range changes during the read. - Adds deterministic tests validating that stable topology does not cause extra provider reads and that joins wait behind the queued range-change turn and the subsequent provider read.
| File | Description |
|---|---|
| test/Orleans.Testing.Reminders/ReminderTopologyStabilizer.cs | Removes redundant refresh and relies on scheduler/reconciliation boundaries for deterministic topology stabilization. |
| test/Orleans.Reminders.Tests/TimerTests/LocalReminderServiceTests.cs | Adds deterministic coverage for “no extra refresh” and “wait for membership range reconciliation” scenarios; updates fixture to use ReminderTestClock. |
| src/Orleans.Runtime/Services/GrainService.cs | Refactors ring subscription into a helper method used on status transitions. |
| src/Orleans.Reminders/ReminderService/LocalReminderService.cs | Subscribes to range changes before initial load and retries initial load when range changes during the read. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes core reminder reconciliation ordering and scheduler/admission behavior with subtle concurrency implications which merit final human validation.
Review tier: Lite
Findings: 1
Pre-existing issues (2)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/Services/GrainService.cs — SubscribeToRangeChangeEvents is declared private protected, which makes it inaccessible to… View comment |
|
src/Orleans.Reminders/ReminderService/LocalReminderService.cs — The initial-load retry loop only compares RangeSerialNumber before/after… View comment |


Problem
Reminder lifecycle topology stabilization enqueued an explicit refresh on every active silo after membership listeners had already processed the current version. That redundant provider work could stall at refresh admission or reconciliation under provider load, even though membership, manifests, and ring ownership had converged.
Replacing the refresh with a separate scheduler turn retained the same admission dependency. Publishing reconciliation generations only when scheduler callbacks executed also allowed queued refreshes and range changes to be observed in a different order from their scheduler execution order.
A topology change during reminder-service startup could additionally invalidate the initial range read before the service subscribed to ring notifications.
Solution
Subscribe the local reminder service to ring changes before its initial read and repeat the load whenever its range changes during the read, so startup readiness covers a stable current range.
Publish and enqueue every range change, explicit refresh, and periodic refresh through one ordered reconciliation-admission path. Generation publication and scheduler FIFO enqueue now occur atomically, and previous-generation waiters are signaled only after the new generation and its exact task are installed. The periodic timer waits outside the grain scheduler and queues the actual refresh turn through this path.
Topology stabilization waits for membership listener processing and then directly awaits the latest published reconciliation generation. It no longer creates unrelated provider work or depends on a separate scheduler no-op.
Add deterministic coverage for stable multi-silo startup, membership-triggered range reconciliation, and both refresh-before-range and range-before-refresh ordering.
Rationale
Membership processing synchronously queues the associated ring changes before publishing its processed version. Using the same admission path for every reconciliation operation preserves that causal order through scheduler execution, so the topology barrier awaits the work caused by the topology itself.
Fixes #11023
Related: #11016, #11108