Description
Steps to Reproduce
Unfortunately, this bug is tricky to reproduce. I can reproduce it reliably with our app, but the bug has for now defied my attempts of reproducing it with a simpler piece of code.
The problem is caused by a Canvas.drawImageRect
call in a RenderBox
derivative whose paint
that draws several (10-20) bitmaps per invocation. The crash occurs only if BlendMode.src
is used; all other blend modes work correctly. The first screen update does not (necessarily) crash; often a dozen frames or so is needed before the crash occurs, but it always occurs in a few seconds.
Other parameters (the image itself, the Rect
instances used for clipping the source and destination, scale factors, etc.) do not seem to matter. If blend mode is src
, there is a crash; if not, everything works.
Affected versions and devices
Using git bisect, I found out that the crash appears with the commit 3f454b61c03093fae46d5b439c84f38040cc05b1
, which in turn is a roll of engine containing two Fuchsia commits and the rolling of Skia by 37 revisions; so probably this issue is related to something implemented in Skia at that point. All versions prior to that commit (e.g. Flutter versions 1.19.0-1.0.pre and earlier) work; all versions after the commit (e.g. Flutter versions 1.19.0-2.0.pre and later) crash.
The crash does not happen on every device; my primary test phone is a Nokia 7.1 with Android 10, and it suffers from the issue. I have witnessed the crash also on a Google Pixel 2 XL and heard about it on some other phones as well, but the Nokia is the only one from which I have logs. I have not heard about the bug occuring on any iPhones, only on Android devices.
Device log
What happens is this:
W/Adreno-GSL(13969): <gsl_ldd_control:549>: ioctl fd 82 code 0xc040094a (IOCTL_KGSL_GPU_COMMAND) failed: errno 71 Protocol error
W/Adreno-GSL(13969): <log_gpu_snapshot:458>: panel.gpuSnapshotPath is not set.not generating user snapshot
W/Adreno-GSL(13969): <gsl_ldd_control:549>: ioctl fd 82 code 0xc040094a (IOCTL_KGSL_GPU_COMMAND) failed: errno 35 Resource deadlock would occur
W/Adreno-GSL(13969): <log_gpu_snapshot:458>: panel.gpuSnapshotPath is not set.not generating user snapshot
W/Adreno-GSL(13969): <gsl_ldd_control:549>: ioctl fd 82 code 0xc040094a (IOCTL_KGSL_GPU_COMMAND) failed: errno 35 Resource deadlock would occur
W/Adreno-GSL(13969): <log_gpu_snapshot:458>: panel.gpuSnapshotPath is not set.not generating user snapshot
Lost connection to device.
Using a minimal app, I can get the first error ("Protocol error") to show up, but that does not kill the app (although there's a noticeable twitch of the screen at that point). The deadlock error always kills the app immediately.
Workaround
As the problem can be worked around by simply clearing the rect first (drawRect
with BlendMode.clear
) and then drawing with the default srcOver
blend mode, this is not a life-or-death issue as such; but it does seem a bit wasteful. Our app seems to lose around 3-4 fps due to this workaround.
Flutter doctor
Flutter doctor output, FWIW:
[√] Flutter (Channel beta, 1.19.0-4.3.pre, on Microsoft Windows [Version 10.0.19041.329], locale en-FI)
• Flutter version 1.19.0-4.3.pre at c:\prg\flutter
• Framework revision 8fe7655ed2 (2 days ago), 2020-07-01 14:31:18 -0700
• Engine revision 9a28c3bcf4
• Dart version 2.9.0 (build 2.9.0-14.1.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at c:\Users\jussi\appdata\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = c:\Users\jussi\appdata\Local\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 47.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code (version 1.45.0)
• VS Code at C:\Users\jussi\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.1
[√] Connected device (3 available)
• Nokia 7 1 • CTLGAP4910801689 • android-arm64 • Android 10 (API 29)
• Web Server • web-server • web-javascript • Flutter Tools
• Chrome • chrome • web-javascript • Google Chrome 83.0.4103.116
• No issues found!
Activity
chinmaygarde commentedon Jul 6, 2020
The commit in the engine is a Skia roll. flutter/engine@6a470b8
pedromassangocode commentedon Dec 4, 2020
Hi @jlahd
Can you confirm if the issue still happening? If yes, are you able to provide some reproducible code sample along with your
flutter doctor -v
?Thank you
pedromassangocode commentedon Dec 30, 2020
Without additional information, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now.
Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.
Could everyone who still has this problem please file a new issue with the exact description of what happens, logs, and the output of
flutter doctor -v
.All system setups can be slightly different, so it's always better to open new issues and reference related issues.
github-actions commentedon Aug 7, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -v
and a minimal reproduction of the issue.