Repository navigation
[tests] Prevent harness window animations from starving dispatch callbacks (#26600) - #26604
Conversation
β¦backs (#26600) ## Cause The instrumented [build 15294223](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15294223) reproduced the recurring 60 Network setup timeouts and nine pasteboard callback timeouts on both macOS Tahoe architectures. The diagnostics distinguish the failure from network connectivity: - Native connections reach Ready within milliseconds, but their managed callbacks never enter. - Default-global dispatch probes never execute; private-queue probes do. - Both native thread samples report `Dispatch Thread Soft Limit: 64 reached` in every sample. - All 64 affected workers are blocked in AppKit's `-[NSAnimation _runBlocking]`. Repeated test-harness window animations exhaust the shared dispatch workers, starving unrelated Network and pasteboard callbacks. Evidence is in the `macos-arm64-monotouch-test.txt` and `macos-x64-monotouch-test.txt` files of `HtmlReport-mac_26_arm64mac_tahoe-1`. ## Fix Set `NSWindowAnimationBehavior.None` on the windows owned by the macOS runner and `TestRuntime.RunAsync`, before showing them. Test windows and images are still displayed; windows created by individual tests retain their own animation behavior. Existing connection timeouts and test selections are unchanged. Add a regression that opens/closes 128 async-test windows, exceeding the observed 64-worker limit, then requires the default global dispatch queue to remain responsive. The temporary callback logging, queue probes, and native sampler have been removed after CI confirmation. The final diff does not modify Network bindings, connection waits, or the packaged runner. ## Validation - ARM64 builds succeed with warnings-as-errors. - All eight dispatch tests, 171 Network tests, and ten pasteboard tests pass locally, including after removing the diagnostic instrumentation. - The 128-window regression also passes without the fix on this interactive Mac; the original failure remains specific to the CI host conditions. - [Build 15295505](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15295505) passes the entire Tahoe stage: all five suites pass, and the macOS apps report **zero failures** on both arm64 (3,686 tests run) and x64 (3,668 tests run). - Both CI architectures pass the 128-window regression and all nine previously failing pasteboard detection tests. Every reported global/private queue probe executes successfully. - Final instrumentation-free commit `a75c5ef334` is verified by [build 15296833](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15296833): Tahoe again passes all five suites, with zero failures on arm64 (3,686 tests run) and x64 (3,668 tests run). Both pass the regression and the previously failing cases, with no diagnostic markers or probes present. - The final build's Sonoma, Sequoia, Tahoe, and Golden Gate macOS stages all pass. The final diff is 24 inserted lines across four files. The investigation originated from builds [15287411](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287411), [15287821](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287821), [15287930](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15287930), [15288406](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15288406), and [15288436](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15288436). --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 002f6f16-1fa4-434a-81af-f99c98564eb8
There was a problem hiding this comment.
π‘ Changes recommended
The regression does not currently exercise the animation scenario, and startup-window coverage is missing.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Prevents macOS test-harness animations from starving dispatch callbacks and adds a regression test.
Changes:
- Disables animations on runner and async-test windows.
- Adds a dispatch responsiveness regression test.
- Documents the harness behavior.
File summaries
| File | Review summary |
|---|---|
tests/README.md |
Documents disabled harness animations. |
tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs |
Regression test needs an initially incomplete task to exercise run-loop pumping; name the 64-worker boundary instead of using bare 128. |
tests/common/Touch.Unit/Touch.Client/Runner/MacRunner.cs |
Add harness-level coverage for the startup-window animation path. |
tests/common/TestRuntime.RunAsync.cs |
Disables animations on async-test windows. |
Review details
Suppressed comments (2)
tests/common/Touch.Unit/Touch.Client/Runner/MacRunner.cs:29
- π‘ Testing β The regression exercises only windows created by
TestRuntime.RunAsync; it never observes this startup-window path, so a future change could restore the runner's default animation behavior while the test still passes. Please add harness-level coverage for this path or centralize both window creations behind a tested helper.
Rule: Bug fixes need regression tests
window.AnimationBehavior = NSWindowAnimationBehavior.None;
tests/monotouch-test/CoreFoundation/DispatchQueueTest.cs:175
- π‘ maintainability β The stress boundary is encoded as a bare
128, while the test's rationale depends on the observed 64-worker cap. Name that cap and derive the window count so a future change to the stress threshold cannot silently make this regression stop exceeding it.
for (var i = 0; i < 128; i++)
Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (5), Task.CompletedTask), Is.True, $"Window {i}");
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
| for (var i = 0; i < 128; i++) | ||
| Assert.That (TestRuntime.RunAsync (TimeSpan.FromSeconds (5), Task.CompletedTask), Is.True, $"Window {i}"); |
This comment has been minimized.
This comment has been minimized.
β [PR Build #3f63a63] Build passed (Detect API changes) βPipeline on Agent |
β [PR Build #3f63a63] Build passed (Build packages) βPipeline on Agent |
β API diff for current PR / commitNET (empty diffs)β API diff vs stableNET (empty diffs)βΉοΈ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
β [PR Build #3f63a63] Build passed (Build macOS tests) βPipeline on Agent |
π [CI Build #3f63a63] Test results πTest resultsβ All tests passed on VSTS: test results. π All 167 tests passed π Tests countsβ
cecil: All 1 tests passed. Html Report (VSDrops) Download macOS testsβ
Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download Linux Build VerificationPipeline on Agent |
Cause
The instrumented build
15294223 reproduced the recurring 60 Network setup timeouts and nine pasteboard callback timeouts on both macOS Tahoe architectures.
The diagnostics distinguish the failure from network connectivity:
Dispatch Thread Soft Limit: 64 reachedin every sample.-[NSAnimation _runBlocking].Repeated test-harness window animations exhaust the shared dispatch workers, starving unrelated Network and pasteboard callbacks. Evidence is in the
macos-arm64-monotouch-test.txtandmacos-x64-monotouch-test.txtfiles ofHtmlReport-mac_26_arm64mac_tahoe-1.Fix
Set
NSWindowAnimationBehavior.Noneon the windows owned by the macOS runner andTestRuntime.RunAsync, before showing them. Test windows and images are still displayed; windows created by individual tests retain their own animation behavior. Existing connection timeouts and test selections are unchanged.Add a regression that opens/closes 128 async-test windows, exceeding the observed 64-worker limit, then requires the default global dispatch queue to remain responsive.
The temporary callback logging, queue probes, and native sampler have been removed after CI confirmation. The final diff does not modify Network bindings, connection waits, or the packaged runner.
Validation
a75c5ef334is verified by build 15296833: Tahoe again passes all five suites, with zero failures on arm64 (3,686 tests run) and x64 (3,668 tests run). Both pass the regression and the previously failing cases, with no diagnostic markers or probes present.The final diff is 24 inserted lines across four files. The investigation originated from builds
15287411, 15287821, 15287930, 15288406, and
15288436.