Repository navigation
fix(membership): do not report a silo dead before it writes its entry - #11581
nightBaker wants to merge 1 commit into
Conversation
|
@dotnet-policy-service agree |
a187ae1 to
9af81b0
Compare
A silo which starts against an empty membership table keeps its initial
view, {self: Created}, because the empty read has version MinValue and is
not a successor. If another silo inserts itself before this silo writes
its own entry, the next read lacks the local silo. ProcessMembershipUpdate
published that view as-is, so observers which diff consecutive views
(SiloStatusListenerManager, ClusterMembershipSnapshot.CreateUpdate) saw the
local entry removed and reported (self, Dead). ConsistentRingProvider and
VirtualBucketsRingProvider treat that as a local shutdown and permanently
exclude the silo from its own ring.
Preserve the local Created entry when a view lacks it. The silo has not
written its entry, so its absence says nothing about its status.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
@dotnet-policy-service agree |
|
@nightBaker, thank you for the thorough investigation, the startup-race reproduction, and this PR. Connecting the false local We have chosen to address this with canonical membership views and separate local lifecycle status in #11588: #11588. That PR builds on your work, retains your original contribution in the commit history, and extends the regression scenario. The key invariant is that every published membership view represents authoritative cluster state. Preserving an uncommitted local The replacement starts with an empty membership snapshot and keeps local This makes #11588 the replacement implementation for this issue rather than an additional fix to merge after this PR. Thanks again for finding the bug and providing such a clear explanation and reproduction. |
Problem
A silo of a new cluster can report itself
Deadto its ownISiloStatusListeners while it is still starting.ConsistentRingProviderandVirtualBucketsRingProvidertreat a terminating status for the local silo as a local shutdown, setrunning = false, and never reset it. From then on the silo never routes a key to itself.The sequence:
MembershipTableManagerstarts with the initial view{self: Created}atMembershipVersion.MinValue(MembershipTableManager.cs#L81-L90).(0, "0")maps toMinValue(MembershipTableSnapshot.cs#L51-L53), is not a successor, and is not published. The view stays{self: Created}.SiloStatusListenerManagerstarts atAfterRuntimeGrainServices, so its first view is that{self: Created}one. Listeners receive(self, Created).MembershipAgent.BecomeJoining(same stage) reads the table again. Another silo has inserted itself in the meantime, so the new view contains that silo but not this one.ProcessMembershipUpdatereturns it unchanged because the previous local status isCreated(MembershipTableManager.cs#L571-L575).SiloStatusListenerManagerdiffs the two views withClusterMembershipSnapshot.CreateUpdate, which reports a removed entry asDead(ClusterMembershipSnapshot.cs#L108-L115). Listeners receive(self, Dead).VirtualBucketsRingProvider.SiloStatusChangeNotification(self, Dead)callsStop()(VirtualBucketsRingProvider.cs#L209-L216).ConsistentRingProviderdoes the same.The silo then writes itself
Joiningand becomesActivenormally. The local status notifications it observed are[Created, Dead, Joining, Active].Impact
Reminders are the visible casualty.
LocalReminderService.RegisterOrUpdateReminderonly schedules a reminder locally when the receiving silo owns the key (LocalReminderService.cs#L256-L260, from #10612). An affected silo sends registrations for keys it owns to its ring successor. The successor only persists the row, and the owner loads it at its nextRefreshReminderListPeriod, up to 5 minutes later.Found while load-testing Fleans (a BPMN engine on Orleans 10.4) on a 6-silo cluster whose 3 reminder-hosting silos start together against a fresh table. 2 of the 3 lost the race at every cold start. About 12 % of timers fired late: p99 lag 252 s, against 0.94 s before the upgrade from 10.0.1. The ring exclusion probably happened on 10.0.1 too, but was invisible because the receiving silo started the timer.
Fix
In
ProcessMembershipUpdate, when a new view lacks the local silo and the local silo is stillCreated, keep the localCreatedentry. The local silo has not written its entry, so its absence from the table says nothing about its status, and the view no longer shows the local entry as removed. Once the silo writes its entry, the table's entry replaces the preserved one. The existing handling of a missing local entry after the silo has joined is unchanged.The fix is in the membership view rather than in the ring providers because every consumer that diffs consecutive views sees the bogus
Dead, not only the rings. This includesIClusterMembershipService.MembershipUpdatessubscribers.Two existing tests asserted that the view omits the local silo while it is
Created. They now assert that the local entry is stillCreated, which checks the same thing: the local status did not advance.Test
MembershipTableManager_NewCluster_OtherSiloJoinsFirst_DoesNotReportLocalSiloDeaddrives the sequence above withInMemoryMembershipTableand a realSiloStatusListenerManager. It starts against an empty table, inserts another silo, and refreshes. It then asserts that the listener receives(self, Created)and(other, Joining)only. Onmainit fails withUnexpected notification: (S127.0.0.1:100:100, Dead).I also checked the symptom on two and three localhost-clustered silos with startup delays that force the race. On
main, the late silo ended withrunning = falsein 3 of 3 runs. With this change, every silo stayedrunning = trueacross 5 runs.Microsoft Reviewers: Open in CodeFlow