[Tests] Stabilize memory pressure monitor race tests#8751
Conversation
There was a problem hiding this comment.
Pull request overview
This PR stabilizes MemoryPressureMonitorTests by removing timing/scheduler-dependent concurrency coordination and replacing it with a deterministic re-entrant test double that triggers overlapping RefreshIfStale / Dispose calls during a controlled sampling point.
Changes:
- Replaced
Task.Run+ blocking/timeouts in race tests with a synchronous re-entrantReentrantMemoryRatioProvider. - Updated the “refresh overlap” test to deterministically attempt a nested refresh during sampling and assert no overlap via call count.
- Updated the “dispose during refresh” test to deterministically dispose mid-sample and assert no high-pressure state is committed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8751) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (73ms) : 70, 76
master - mean (74ms) : 70, 78
section Bailout
This PR (8751) - mean (79ms) : 75, 83
master - mean (79ms) : 75, 83
section CallTarget+Inlining+NGEN
This PR (8751) - mean (1,106ms) : 1056, 1155
master - mean (1,110ms) : 1047, 1174
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (115ms) : 108, 123
master - mean (116ms) : 110, 122
section Bailout
This PR (8751) - mean (117ms) : 111, 123
master - mean (114ms) : 111, 118
section CallTarget+Inlining+NGEN
This PR (8751) - mean (795ms) : 772, 818
master - mean (797ms) : 775, 820
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (101ms) : 97, 105
master - mean (102ms) : 96, 108
section Bailout
This PR (8751) - mean (102ms) : 99, 104
master - mean (106ms) : 100, 111
section CallTarget+Inlining+NGEN
This PR (8751) - mean (953ms) : 917, 990
master - mean (947ms) : 901, 993
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (103ms) : 98, 108
master - mean (100ms) : 96, 103
section Bailout
This PR (8751) - mean (101ms) : 98, 103
master - mean (103ms) : 97, 109
section CallTarget+Inlining+NGEN
This PR (8751) - mean (823ms) : 787, 860
master - mean (827ms) : 783, 871
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (199ms) : 194, 204
master - mean (199ms) : 194, 204
section Bailout
This PR (8751) - mean (203ms) : 198, 208
master - mean (202ms) : 198, 205
section CallTarget+Inlining+NGEN
This PR (8751) - mean (1,200ms) : 1161, 1240
master - mean (1,204ms) : 1155, 1252
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (288ms) : 280, 295
master - mean (288ms) : 282, 295
section Bailout
This PR (8751) - mean (288ms) : 281, 295
master - mean (289ms) : 282, 296
section CallTarget+Inlining+NGEN
This PR (8751) - mean (967ms) : 946, 988
master - mean (967ms) : 941, 992
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (279ms) : 269, 289
master - mean (278ms) : 270, 287
section Bailout
This PR (8751) - mean (280ms) : 273, 287
master - mean (278ms) : 274, 283
section CallTarget+Inlining+NGEN
This PR (8751) - mean (1,164ms) : 1128, 1201
master - mean (1,155ms) : 1109, 1202
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8751) - mean (279ms) : 270, 287
master - mean (276ms) : 268, 284
section Bailout
This PR (8751) - mean (281ms) : 274, 288
master - mean (278ms) : 269, 288
section CallTarget+Inlining+NGEN
This PR (8751) - mean (1,042ms) : 994, 1090
master - mean (1,041ms) : 996, 1086
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
BenchmarksBenchmark execution time: 2026-06-04 15:59:03 Comparing candidate commit 7549950 in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 71 metrics, 0 unstable metrics, 60 known flaky benchmarks, 66 flaky benchmarks without significant changes.
|
Summary of changes
MemoryPressureMonitorTestsrace coverage.Reason for change
Implementation details
_refreshInProgressprevents overlapping refreshes by asserting the memory reader call count remains2.Test coverage
MemoryPressureMonitorTests