Sitelet https://github.com/flutter/flutter/pull/190490
Skip to content

Fix a flake in ShellTest.SecondaryVsyncCallbackShouldBeCalledAfterVsyncCallback - #190490

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jason-simmons:bug_190430
Aug 5, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
jason-simmons:bug_190430

Conversation

@jason-simmons

Copy link
Copy Markdown
Member

That test calls the engine's ScheduleSecondaryVsyncCallback and ScheduleFrame APIs. If a vsync occurs between the two calls, then the secondary callback will be executed at that vsync, but the frame will be scheduled at the next vsync. That will cause a false negative in the test.

This PR changes the test to execute the API calls shortly after a vsync happens. That should ensure that both calls happen during the same vsync interval.

This also fixes an issue where VsyncWaiter::FireCallback was not properly resetting the VsyncWaiter's callback. The failure to reset the callback meant that a second call to AsyncWaitForVsync with a different callback would not actually take effect.

Fixes #190430

…ncCallback

That test calls the engine's ScheduleSecondaryVsyncCallback and
ScheduleFrame APIs.  If a vsync occurs between the two calls, then the
secondary callback will be executed at that vsync, but the frame will
be scheduled at the next vsync.  That will cause a false negative in
the test.

This PR changes the test to execute the API calls shortly after a
vsync happens.  That should ensure that both calls happen during the
same vsync interval.

This also fixes an issue where VsyncWaiter::FireCallback was not
properly resetting the VsyncWaiter's callback.  The failure to reset
the callback meant that a second call to AsyncWaitForVsync with a
different callback would not actually take effect.

Fixes flutter#190430
@jason-simmons
jason-simmons requested a review from cbracken August 4, 2026 00:18
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 4, 2026
@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Aug 4, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the SecondaryVsyncCallbackShouldBeCalledAfterVsyncCallback unit test to execute the test task within a vsync interval, and replaces a move operation with a swap in vsync_waiter.cc. Feedback highlights that using ASSERT_TRUE inside a task running on the UI thread can cause the test to hang indefinitely if it fails, and suggests replacing it with EXPECT_TRUE while safely counting down the latch on failure.

Comment thread engine/src/flutter/shell/common/shell_unittests.cc

@cbracken cbracken left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM stamp from a Japanese personal seal

Thanks @jason-simmons !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShellTest.SecondaryVsyncCallbackShouldBeCalledAfterVsyncCallback fails under load due to PipelineFull and VsyncWaiter registration race

2 participants