Conversation
While auditing for the changes in this PR, the in-process L1 freshness check came up as a separate candidate — same shape as open-telemetry/opentelemetry-dotnet#7253, but with a tighter design constraint that kept it out of the present PR. Sites (all in
Why it's not in this PR: Why it's worth doing eventually: cache TTL windows are minutes-to-hours rather than seconds, so the bug-class exposure window is much larger than the deadline gates in this PR; the failure mode (cache stampede on forward NTP step, stale data on backward step) is also more visible than a circuit-breaker blip. Same Tier 1 case OTel addressed in #7253. Confirmed-skip (no fix possible/needed because they cross a process boundary): Happy to open a separate PR for the L1 freshness piece if there's interest — wanted to flag the audit notes here first rather than doing it as drive-by scope-creep. |
…arrier SimpleCircuitBreaker and AutoRecoveryService are in-process deadline gates, so their elapsed-time math should not be affected by wall-clock adjustments (NTP correction, manual clock change). Both now store a monotonic anchor from Stopwatch.GetTimestamp() and compare the elapsed time against the configured duration, instead of storing a DateTimeOffset.UtcNow based deadline. Since a Stopwatch timestamp is an opaque counter, long.MinValue is used as the "not set" sentinel. StopwatchPolyfill provides Stopwatch.GetElapsedTime for the netstandard2.0 target, where it is not available. Wall-clock usage is preserved for serialized timestamps (LogicalExpirationTimestamp, BackplaneMessage.Timestamp, AutoRecoveryItem expiration), since those cross process boundaries.
6a3948b to
b92918d
Compare
|
Hi @unsafePtr , I just updated the test project to Microsoft Testing Platform to see if that helps fix the test running issues we were having here. Meanwhile I'm starting to look at your PR, thanks for sending it! |
Switch SimpleCircuitBreaker and AutoRecoveryService from
DateTimeOffset.UtcNowbased deadlines toStopwatch.GetElapsedTime. Both are in-process deadline gates; their elapsed-time math should be unaffected by wall-clock adjustments (NTP correction, manual clock change).Same change was recently added by me to dotnet/runtime#127303. I am flagging this as a refactor, since in-process deadline gates should be measured monotonically, even though using DateTime.UtcNow in this use-case will probably never lead to problems in practice. This mirrors open-telemetry/opentelemetry-dotnet#7193 (sweep) and open-telemetry/opentelemetry-dotnet#7253 (in-process freshness check).
Wall-clock usage is preserved for serialized timestamps (LogicalExpirationTimestamp, BackplaneMessage.Timestamp, AutoRecoveryItem expiration) since those cross process boundaries.