test(client): synchronize dynamic reconnect replacement timer - #699
Merged
Merged
Conversation
This was referenced Sep 18, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #387.
New record analyzed
Nightly Regression #285 reported
SharpLinkReconnectPolicyLifecycleRaceTests.DynamicGenerationReplacementShouldRetireTheOldReconnectOwnerAcrossPolicyWakeon macOS. After generation 2 was materialized / snapshot-processed, the test advanced manual time by 999ms + 1ms but observedold=1, new=0.Static root cause
This is a test synchronization race around reconnect-policy wake, not a demonstrated production ownership failure.
DynamicClusterReconnectCoordinator.EnsureReconnectstartsReconnectAsyncsynchronously up to its first reconnect-delay await. If generation replacement is processed just beforeUpdateReconnectPolicy, the replacement owner can first arm the old policy's 10-second timer. The policy update then cancels that generation's delay; re-entering the reconnect loop and arming the new 1-second timer happens on the async cancellation continuation.PublishedSnapshotProcessedproves topology application plus the initial reconnect reconciliation returned, but it does not prove that this policy-wake continuation has run. Likewise,CreatedTimerCount > beforeReplacementcan be satisfied by the now-cancelled 10-second timer. The test can therefore advance fake time to t=1 before the live one-second timer exists; if the continuation then arms the timer at t=1, it is due at t=2 and the test never advances again.Fix
Use the test-local
ManualTimeProvider.WaitForPendingTimerAsync(TimeSpan.FromSeconds(1))seam, already present in this file for the analogous reconnect timer-registration race, before advancing fake time. This requires a live timer at exactly the current manual timestamp + one second and cannot be satisfied by the cancelled old-policy 10-second wait.The existing assertions remain intact:
No production code, reconnect semantics, timeout widening, retries, sleeps, or workflow changes.
Validation
Static analysis / diff review locally; executable validation is delegated to PR CI.