Skip to content

Conversation

@davidmartos96
Copy link
Contributor

Stable Cherry Pick

Cherry-picks #173014 to stable to fix unhandled crash on Android Snapdragon 845 devices due to a corrupted cache, preventing apps from starting.

Fixes #172624

Impacted Users: All users with Android Snapdragon 845
Impact Description: the app can crash on start because of a corrupted cache.
Workaround: None
Risk: Low
Test Coverage: A test is included that checks succesful reads of an incomplete vk cache
Validation Steps: #172624 (comment)

This crash has unfortunately prevented our app from using Flutter 3.35 and even 3.32, missing out a whole new set of fixes from these last Flutter releases for quite some time now.

cc @jason-simmons (PR author) @chinmaygarde (PR reviewer) in case there is something I could have missed with the CP request and description

…tter#173014)

PipelineCacheDataPersist runs on a worker thread pool. The raster thread
may be executing rendering operations while PipelineCacheDataPersist is
reading the state of the pipeline cache.

PipelineCacheDataPersist calls vkGetPipelineCacheData to get the size
required for the cache data buffer and then calls it again to fill the
buffer. If the cache state changed between those two calls, then the
count of bytes written may be less than the size returned by the first
call. In that case, PipelineCacheDataPersist should only write the
portion of the buffer that was filled.

This PR also adds a mutex to PipelineCacheVK::PersistCacheToDisk.
PipelineLibraryVK could queue multiple PersistCacheToDisk tasks to
different worker pool threads. These tasks should not run concurrently.

See flutter#172624
@flutter-dashboard
Copy link

This pull request was opened from and to a release candidate branch. This should only be done as part of the official Flutter release process. If you are attempting to make a regular contribution to the Flutter project, please close this PR and follow the instructions at Tree Hygiene for detailed instructions on contributing to Flutter.

Reviewers: Use caution before merging pull requests to release branches. Ensure the proper procedure has been followed.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Oct 4, 2025
Copy link
Contributor

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

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 cherry-picks a critical fix for a crash on some Android devices caused by a corrupted Vulkan pipeline cache. The changes correctly address the issue by ensuring the cache file header reflects the actual size of the written cache data, even when the driver reports a smaller size than initially queried. A new unit test has been added to verify this fix using a mock Vulkan implementation that simulates the problematic driver behavior. Additionally, a potential race condition in persisting the cache to disk has been resolved by introducing a mutex, improving thread safety. The changes are well-implemented and effectively resolve the reported crash.

@chinmaygarde
Copy link
Member

Triage: The commit author has verified that this is low risk and the only contents of this patch is the revert. We need to verify if the release window is still open. Pinging the release hotline.

@reidbaker reidbaker requested a review from camsim99 October 6, 2025 18:41
@reidbaker
Copy link
Contributor

@chinmaygarde or @jason-simmons can you approve this pr if you are comfortable with it landing?

@reidbaker reidbaker requested a review from chinmaygarde October 6, 2025 18:43
@camsim99 camsim99 added the cp: review Cherry-picks in the review queue label Oct 7, 2025
Copy link
Contributor

@camsim99 camsim99 left a comment

Choose a reason for hiding this comment

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

LGTM

@camsim99 camsim99 added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 7, 2025
@auto-submit auto-submit bot merged commit d291363 into flutter:flutter-3.35-candidate.0 Oct 7, 2025
161 checks passed
@camsim99 camsim99 mentioned this pull request Oct 7, 2025
9 tasks
auto-submit bot pushed a commit that referenced this pull request Oct 8, 2025
Updates `CHANGELOG` to include the two cherry picks in the 3.35.6 hotfix stable release:

#176520
#176359

**Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 9, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 10, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants