Runtime.Tests flakes: metadata-renewal wire tests pace the fake clock with wall-clock delays (Live_predecessor_cadence..., Two_sdk_cadences_renew_before_expiry...) #965

Closed
opened 2026-12-01 21:31:16 -05:00 by dohertj2 · 1 comment
Owner

Seen 2026-12-01 in the #962 repro loop: 30 full FullyQualifiedName~DataConnections&Category!=SlowUnit runs, 3 parallel lanes, host load ~60. Each failed once; both passed on the other 29 runs.

  1. GrpcDataConfiguredDiscoveryWireTests.Live_predecessor_cadence_publishes_ordinary_delta_after_peer_adopts_next_authority (GrpcDataMetadataRenewalPredecessorWireTests.cs:50): OperationCanceledException from NextPublished (its own 10 s wall-clock timeout) waiting for p2First after the while (elapsed < 7.5 s) { Clock.Advance(125 ms); await Task.Delay(20) } loop. Run time 12 s.
  2. GrpcDataConfiguredDiscoveryWireTests.Two_sdk_cadences_renew_before_expiry_without_reviving_old_notification_evidence (GrpcDataMetadataRenewalContinuityWireTests.cs:81): renewedLease.Remaining - crossExpiry should be greater than 00:00:07.5 but was 00:00:07.45. The 8 x { Clock.Advance(500 ms); await Task.Delay(100) } loop can advance the fake clock past the moment the successor lease was issued, so the margin depends on how many advances land before the renewal is processed.

Both drive a ManualTimeProvider in steps timed by wall-clock Task.Delay, so under CPU load the fake clock advances further (or the real work lags further) than the assertions assume. Not investigated whether either hides a production race (cf. #859/#920/#962, which were real). Suggested: advance the clock only after an awaited positive signal (renewal issued / successor adopted) instead of on a wall-clock cadence, or assert against the clock value captured at successor issue.

Found while working #962; out of scope there.

Seen 2026-12-01 in the #962 repro loop: 30 full `FullyQualifiedName~DataConnections&Category!=SlowUnit` runs, 3 parallel lanes, host load ~60. Each failed once; both passed on the other 29 runs. 1. `GrpcDataConfiguredDiscoveryWireTests.Live_predecessor_cadence_publishes_ordinary_delta_after_peer_adopts_next_authority` (GrpcDataMetadataRenewalPredecessorWireTests.cs:50): `OperationCanceledException` from `NextPublished` (its own 10 s wall-clock timeout) waiting for `p2First` after the `while (elapsed < 7.5 s) { Clock.Advance(125 ms); await Task.Delay(20) }` loop. Run time 12 s. 2. `GrpcDataConfiguredDiscoveryWireTests.Two_sdk_cadences_renew_before_expiry_without_reviving_old_notification_evidence` (GrpcDataMetadataRenewalContinuityWireTests.cs:81): `renewedLease.Remaining - crossExpiry should be greater than 00:00:07.5 but was 00:00:07.45`. The 8 x `{ Clock.Advance(500 ms); await Task.Delay(100) }` loop can advance the fake clock past the moment the successor lease was issued, so the margin depends on how many advances land before the renewal is processed. Both drive a ManualTimeProvider in steps timed by wall-clock `Task.Delay`, so under CPU load the fake clock advances further (or the real work lags further) than the assertions assume. Not investigated whether either hides a production race (cf. #859/#920/#962, which were real). Suggested: advance the clock only after an awaited positive signal (renewal issued / successor adopted) instead of on a wall-clock cadence, or assert against the clock value captured at successor issue. Found while working #962; out of scope there.
dohertj2 added the type:testpriority:p3 labels 2026-12-01 21:31:16 -05:00
Author
Owner

Fixed in 34014190a (merged c38f78d1f). Wall-clock pacing is replaced with renewal-tick quiescence counters (ProjectedDataAccess.RenewalTicksQuiescentForTests) and ManualTimeProvider.AdvanceInOneStep. Also fixed a second mode where the shared node could legitimately publish 8 before 9. Production renewal logic was verified correct. A residual ~1% hang under very heavy load (also present in the original code) is tracked in #968. DataConnections on merged master: 1026/1026.

Fixed in 34014190a (merged c38f78d1f). Wall-clock pacing is replaced with renewal-tick quiescence counters (ProjectedDataAccess.RenewalTicksQuiescentForTests) and ManualTimeProvider.AdvanceInOneStep. Also fixed a second mode where the shared node could legitimately publish 8 before 9. Production renewal logic was verified correct. A residual ~1% hang under very heavy load (also present in the original code) is tracked in #968. DataConnections on merged master: 1026/1026.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dohertj2/lmxopcua#965