Skip to content

Flaky Skia-WASM runtime tests: render-loop animations stall under headless xvfb browser #23524

Closed

Description

@nickrandolph

Summary

A cluster of Skia-on-WebAssembly runtime tests is flaky in CI (fails 4–6 of every 6 master
builds), forcing expensive stage retries and keeping master red. The same tests pass reliably on
Linux/Windows/macOS/Android Skia (identical managed Skia code) — only the browser host flakes.

Root cause (investigated)

The failing tests all wait on a render-loop (requestAnimationFrame)-driven operation —
scroll / BringIntoView / ScrollIntoView / virtualization realization / animation. In CI,
build/test-scripts/wasm-run-skia-runtime-tests.sh launched xvfb-run google-chrome … URL with
no window manager and an unspecified screen, so the browser window is effectively
background/zero-size and Chromium throttles rAF/timers (~1 Hz) and/or starves rendering. The
animations then never settle and the tests time out.

Evidence:

  • Locally (headful Edge, real display + WM + sized window) the 6 representative tests pass 72/72
    (6 tests × 12 runs); in CI they fail 67–100%.
  • linux-skia-runtime-tests.sh (which is not flaky) launches its app under
    xvfb -screen 0 1280x1024x24 with fluxbox — the WASM script had neither.
  • A normally ~1 s scroll animation timing out at >5 s matches rAF throttled to ~1 Hz.

Partial fix applied (PR #23521)

wasm-run-skia-runtime-tests.sh now mirrors the passing linux-skia setup
(-screen 0 1920x1080x24 + fluxbox + --window-size + --disable-background-timer-throttling --disable-renderer-backgrounding --disable-backgrounding-occluded-windows). This reduced the
WASM-Skia runtime failures (≈13 → ≈10 distinct) but did not eliminate them — the headless
browser still does not reliably drive these animations. Deeper work is needed (e.g. a test-harness
render-loop pump on WASM, or making these scrolls non-animated under test).

Affected tests

Environment-rooted scroll/virtualization/animation (excluded on SkiaWasm via [GitHubWorkItem]
pending the deeper fix; still covered on all other Skia targets):

  • Given_PipsPager.When_SelectedIndex_Beyond_MaxVisiblePips_All_Visible_Pips_Are_Realized
  • Given_Theme_Materialization.When_Virtualized_Item_In_Light_Island_Under_Dark_Ambient_Resolves_Light
  • Given_Theme_Materialization.When_Nested_Template_Cell_Scrolled_Into_View_Resolves_Light
  • Given_TreeView.When_SelectNode_DoesNotToggle_OtherNodesExpansion
  • Given_ListViewBase.When_ScrollIntoView_No_Virtualization
  • Given_CalendarView.When_NextMonth_InQuickSequence

Need separate investigation (NOT excluded — may be real product bugs / WASM-only coverage):

  • Given_TextBox.When_Ctrl_Delete, When_Repeated_Delete_Undo_Redo (edit/undo semantics differ on WASM)
  • Given_FrameworkElement_And_Leak.When_Add_Remove(NavigationView, 15) (WASM GC nondeterminism)
  • Given_AccessibleTextBox.When_Accessibility_Is_Enabled_After_Text_Exists… (WASM-only DOM; async detach)

Separate, larger issue (not flakiness)

The screenshot comparison stage is ~entirely red in every build (~14 of ~2362 pass) — a systemic
stale-baseline / rendering-shift problem requiring a baseline-regeneration decision, tracked separately.

Activity

  1. added
    kind/bug
    on Jun 23, 2026
  2. nickrandolph commented on Jun 23, 2026

    @nickrandolph
    ContributorAuthor

    Validation + residual tail (from PR #23521, build 219522)

    After the fixes (CI launch env fix + 12 WaitFor hardenings + 6 SkiaWasm exclusions here, plus the 2
    real-bug exclusions in #23525), the "Tests - WebAssembly Skia" stage now succeeds — it was failing
    13+ runtime tests on every recent master build.

    The stage now passes via the built-in retry mechanism with a small residual low-frequency tail —
    these failed once then passed on retry (vs. 13+ before). Same render-loop / UI-timing class; the
    UITestHelper.WaitFor(() => <real post-condition>, timeoutMS: 5000) pattern (and WaitForIdle(waitForCompositionAnimations: true)) applies for incremental hardening as they recur:

    • Given_FrameworkElement_And_Leak.When_Add_Remove(NavigationView, 15) — WASM GC nondeterminism (intentionally not excluded; broad exclusion would drop leak coverage for all controls on WASM).
    • Given_TextBox...When_Caret_Positioning_With_Complex_Transformations — newly surfaced (~1-in-N; not in the 15-build sample).
    • ...When_Initial_Focus_With_DefaultButton_Set — newly surfaced.
    • ...When_MenuFlyout_Item_Uses_Owner_Subtree_Theme_Light_Under_Dark_App — newly surfaced.

    These are tracked here for incremental hardening rather than batch-excluded — chasing every 1-in-N flake
    at once is whack-a-mole, and they aren't reliably reproducible for fail-before/pass-after validation.

  3. nickrandolph commented on Jun 23, 2026

    @nickrandolph
    ContributorAuthor

    Residual tail confirmed ENVIRONMENT-related (not real bugs)

    Reproduced the three newly-surfaced tail tests in a healthy local WASM browser (real display +
    window manager + anti-throttle flags) — the same conditions the CI env fix establishes:

    Test Healthy local WASM
    Given_TextBox.When_Caret_Positioning_With_Complex_Transformations 15/15 pass
    Given_ContentDialog.When_Initial_Focus_With_DefaultButton_Set 15/15 pass
    Given_MenuFlyout.When_MenuFlyout_Item_Uses_Owner_Subtree_Theme_Light_Under_Dark_App 15/15 pass

    So these are the same render-loop/timing class as the rest of this issue — they pass reliably once
    the browser window is real/focused. The CI launch fix (screen + window manager + anti-throttle) is the
    correct root-cause fix for the whole class; the few that still flake ~1-in-N are caught by the
    stage's retry. No per-test exclusion or hardening is warranted for these — closing the loop on the
    tail. (Contrast: the two TextBox tests in #23525 fail 6/6 even in a healthy browser → genuine bugs.)

  4. nickrandolph commented on Jun 24, 2026

    @nickrandolph
    ContributorAuthor

    Whole WASM-Skia tail empirically confirmed environment-class (not buggy)

    Reproduced every identified tail test in a healthy local WASM browser (real display + window
    manager + anti-throttle — i.e. the conditions the CI env fix establishes). All pass reliably:

    Test Healthy local WASM
    Given_TextBox.When_Caret_Positioning_With_Complex_Transformations 15/15
    Given_ContentDialog.When_Initial_Focus_With_DefaultButton_Set 15/15
    Given_MenuFlyout.When_MenuFlyout_Item_Uses_Owner_Subtree_Theme… 15/15
    Given_MenuFlyout.When_MenuFlyout_Opens_First_Time_Foreground_Should_Not_Flash… 15/15
    Given_AccessibleTextBox.When_Accessibility_Is_Enabled_After_Text_Exists… 15/15

    Conclusion: the tail tests are correct — the CI browser environment was the defect, fixed at the
    root by the launch change (screen + window manager + anti-throttle). The residual ~1-per-run CI flakes
    are the env fix not being 100% under heavy parallel agent load, and are absorbed by the stage's retry
    (the stage goes green). There is no per-test bug to fix here; in fact Opens_First_Time is a
    flash-detector whose checkpoints must NOT be wrapped in waits (that would mask the very flash it guards).

    Remaining residual reduction is a CI-infrastructure matter (browser parallelism / agent resources),
    not test code. The two genuinely-buggy WASM TextBox tests are separate (#23525).

  5. self-assigned this
    on Jun 24, 2026
  6. added a commit that references this issue on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions