Skip to content

Using BlendMode.src crashes #60817

Closed
Closed
@jlahd

Description

@jlahd
Contributor

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

added
engineflutter/engine repository. See also e: labels.
platform-androidAndroid applications specifically
c: crashStack traces logged to the console
c: fatal crashCrashes that terminate the process
c: regressionIt was better in the past than it is now
on Jul 3, 2020
chinmaygarde

chinmaygarde commented on Jul 6, 2020

@chinmaygarde
Member

The commit in the engine is a Skia roll. flutter/engine@6a470b8

added
P2Important issues not at the top of the work list
on Jul 6, 2020
pedromassangocode

pedromassangocode commented on Dec 4, 2020

@pedromassangocode

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

pedromassangocode commented on Dec 30, 2020

@pedromassangocode

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.

removed
waiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds
on Dec 30, 2020
github-actions

github-actions commented on Aug 7, 2021

@github-actions

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.

locked as resolved and limited conversation to collaborators on Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processc: regressionIt was better in the past than it is nowengineflutter/engine repository. See also e: labels.found in release: 1.19Found to occur in 1.19found in release: 1.20Found to occur in 1.20platform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @chinmaygarde@jlahd@VladyslavBondarenko@pedromassangocode

        Issue actions

          Using BlendMode.src crashes · Issue #60817 · flutter/flutter