Repository navigation
Description
Current behavior π
On Skia, NativeDispatcher can starve its Low and Idle priority queues indefinitely while rendering is
active. Anything awaiting CoreDispatcher.RunIdleAsync then never resumes β the app is not deadlocked (it keeps
rendering) but idle-priority work stops making progress for minutes at a time.
The starvation path β src/Uno.UI.Dispatching/Native/NativeDispatcher.cs:
DispatchItems consults TryGetRenderAction() before it scans the four priority queues (:134), so a pending
render action outranks every queued item. The only anti-starvation guard is
normalItemsToProcessBeforeNextRenderAction, and it counts the Normal queue alone:
// :216 β budget re-seeded from the Normal queue only
_compositionTargets[compositionTarget] = (renderAction: null,
normalItemsToProcessBeforeNextRenderAction: _queues[(int)NativeDispatcherPriority.Normal].Count);
// :156 β and decremented only when a Normal item is dispatched
if (@this._currentPriority == NativeDispatcherPriority.Normal) { ... }When the Normal queue is empty β the ordinary state on a settled visual tree β the budget is re-seeded to 0 on
every render, so the next render action is immediately eligible again and Low/Idle never get a turn.
What keeps render actions arriving β src/Uno.UI/UI/Xaml/Media/CompositionTarget.Rendering.skia.cs:168:
if (_isRenderingActive) { ((ICompositionTarget)this).RequestNewFrame(); }_isRenderingActive is a process-wide static (:28) that is true whenever any CompositionTarget.Rendering
subscriber exists. In practice that means a live ScrollPresenter (:6632), ScrollView (:1125), any
Storyboard via DispatcherAnimator (:19), BuildTreeScheduler (:90), ItemsView (:584),
ViewportManagerWithPlatformFeatures (:431) or an in-flight GestureRecognizer inertia processor (:351).
So a scrolling list, or any running animation, is enough to arm the loop.
Why macOS is where it bites. macOS is the only Skia host without a render thread or frame pacer
(grep -rln FramePacer src matches Win32 and X11 only). MacOSWindowHost.InvalidateRender()
(src/Uno.UI.Runtime.Skia.MacOS/UI/Xaml/Window/MacOSWindowHost.cs:288) is a bare uno_window_invalidate β
needsDisplay = YES, and AppKit then draws on the dispatcher's own thread, so display and dispatch interleave
roughly 1:1 and the render action is essentially always pending. Win32 documents this precise hazard in-code at
src/Uno.UI.Runtime.Skia.Win32/Rendering/Win32WindowWrapper.Rendering.cs:19-24.
User-visible impact beyond CI. Everything that relies on idle-priority work can stall on macOS while a
ScrollViewer or a Storyboard is live β CoreDispatcher.RunIdleAsync callbacks, CommandBar close
(CommandBar.Partial.cs:359), template-pool scavenging (FrameworkTemplatePoolDefaultPlatformProvider.cs:69),
DispatcherConditionalDisposable cleanup.
How it shows up in CI. The Tests - Desktop Skia macOS stage runs every runtime test in one process and hits
its 60-minute cap. Individual tests freeze in total log silence β no rendering warnings, no exceptions β then
resume and pass:
15:47:48.4488370Z Running test When_Focused_Element_In_Scaled_Viewbox()
[ 22 min 27 s, zero log output ]
16:10:15.5132900Z Running test When_Focused_Element_Scrolled()
Across 124 macOS task logs there are 74 silent gaps longer than 120 s; in 47 of them the gap opens
immediately after the Running test marker, i.e. inside the first await WaitForIdle() after WindowContent
is assigned. Stall durations are unquantized (250 s β¦ 2047 s), so nothing is timing out β the wait simply
resumes when the interleave happens to break.
Measured on master, per-test durations parsed from the CI task logs:
| window | runs | median suite | median time stalled | runs affected |
|---|---|---|---|---|
| 2026-04-23 β 06-05 | 16 | 24.5 min | 6.5 min | 10 / 16 |
| 2026-06-06 β 07-15 | 29 | 20.5 min | 0.2 min | 0 / 29 |
| 2026-07-16 β 08-10 | 54 | 36.1 min | 10.9 min | 52 / 54 |
Windows runs the same commits in 15.2 min and never stalls. Tests observed stalling, all of which hold a live
CompositionTarget.Rendering subscription at the moment they wait:
Given_SystemFocusVisual.When_Focused_Element_In_Scaled_Viewbox(worst: 1613 s)Given_SystemFocusVisual.When_Focused_Element_Scrolled(worst: 2047 s)Given_SystemFocusVisual.When_Focused_Element_Transformed,β¦_With_Multiple_Parent_TransformsGiven_TextBlock.When_Focus_Changes_Selection_Is_Not_Shown(worst: 769 s)Given_ListViewBase.When_Reorder_DragDrop_ReusesContainers(worst: 1419 s),β¦When_UpdateLayout_In_DragDroppingCommandBarIntegrationTests.ValidateOverflowButtonHidesWhenAppropriate*
A May 2026 instance of the same failure shape (Given_TextBox.When_Touch_Focused_Then_Scrolled_Away, 250β1650 s
on 10 of 16 runs) stopped on 2026-06-05 at 458be6f70d, which removed a per-frame
FrameRendered β Enqueue(β¦, Idle) keep-alive in TextBox.skia.cs β the same mechanism, cured by removing the
thing that kept the loop armed rather than by fixing the starvation.
This is not attributable to a single commit. A build on feature/breakingchanges @ 004885fda6 from
2026-07-14 stalled 35 min 24 s while containing none of the commits that bracket the July step change.
Expected behavior π―
Idle- and Low-priority dispatcher work makes forward progress regardless of how many render actions are pending.
await CoreDispatcher.Main.RunIdleAsync(...) should complete within a frame or two even while a
CompositionTarget.Rendering subscriber is keeping the render loop armed, and rendering should keep advancing
while idle work is queued β neither side may starve the other.
How to reproduce it (as minimally and precisely as possible) π¬
No sample app is needed β this reproduces inside the framework's own runtime tests. Minimal case on Skia macOS:
- Subscribe a no-op handler to
CompositionTarget.Rendering(this is what a liveScrollVieweror any
Storyboarddoes), which sets the process-wide_isRenderingActiveand re-arms a render request every frame. await CoreDispatcher.Main.RunIdleAsync(_ => { })on the UI thread.- The idle callback is not invoked for an unbounded time β observed from seconds to over 30 minutes.
A regression test covering exactly this is added in the linked PR
(src/Uno.UI.RuntimeTests/Tests/Uno_UI_Dispatching/Given_NativeDispatcher.cs): it asserts the idle callback runs
within a generous ceiling, and asserts the converse β that frames continue to advance while idle work is queued.
End-to-end, the stall is intermittent (~40 % of CI runs for the worst test), so reproduce by running
Given_SystemFocusVisual repeatedly on Skia macOS rather than expecting a single run to hang.
Workaround π οΈ
For applications: none. Avoiding idle-priority work is not practical, since the framework itself schedules on it.
For CI, mitigations that make the stage survive without addressing the defect: a default per-test timeout in
UnitTestsControl (GetTestTimeout currently returns null unless a test carries [Timeout], so the runner
falls through to a bare await task), bounding TestServices.WindowHelper.WaitForIdle() (two RunIdleAsync
awaits with no timeout β and WaitFor only checks its deadline between awaits, so its nominal 1000 ms timeout
can never fire), and sharding the macOS stage the way the WebAssembly/Android/iOS stages already do.
Renderer π¨
Skia
Affected platforms π±π»π₯οΈ
Desktop (macOS) β reproduced and measured here. The starvation logic itself is in shared code compiled for
Skia, WebAssembly, native Android and native iOS; the other hosts have not been observed to stall, and Win32/X11
avoid it because they produce frames on a separate paced thread.
Uno.Sdk version (and other relevant versions) π¦
Uno Platform repository master @ 792ab0c6f4 (6.8-dev). Reproduced on CI images macos-15 and locally on
macOS 15 / .NET SDK 10.0.103.
Anything else we need to know? π¬
The obvious patch β widening normalItemsToProcessBeforeNextRenderAction to count all four queues while leaving
the decrement in the _currentPriority == Normal branch β deadlocks rendering: once the Normal queue drains,
the budget never returns to 0 and no render action is ever handed out again. Any fix must keep both directions
bounded.
src/Uno.UI/UI/Xaml/Media/CompositionTarget.Rendering.skia.cs:79 also declares
internal event Action? FrameRendered;, which AGENTS.md prohibits outright (EventHandler/EventHandler<T>
only). Unrelated to this bug, but in the same file.
Activity
MartinZikmund commentedon Oct 14, 2026
Details from duplicate #24005 that are not in this issue yet:
Tests - Desktop Skia macOSjob time went from ~26 to ~37-42 min on all branches at once on 2026-07-16. That produced 87 timeout occurrences across job attempts (bc-branch 17/58, bc-pr 46/203, master 24/142). Master's are largely masked by a 41.3% stage retry rate.timeoutInMinutesis not advisable: 4 of 9 sampled stalls ran 26-40 min.https://dev.azure.com/uno-platform/1dd81cbd-cb35-41de-a570-b0df3571a196/_apis/build/builds/223736/logs/1177?api-version=7.1(25m36s gap). Stall watchdog/heartbeat work is in #24004.fix(dispatching): Let Low/Idle work run while every frame is busy
fix(dispatching): Let Low/Idle work run while every frame is busy
fix(dispatching): Let Low/Idle work run while every frame is busy
fix(dispatching): Let Low/Idle work run while every frame is busy