Skip to content

drawRenderNode called on a context with no surface! #112254

Closed

Description

@Passer-by

Scene

  1. Custom FlutterEngine instance created by the developer is used in FlutterActivity
  2. Flutter UI uses PlatformView

Steps to Reproduce

  1. Open developer mode, Turn on the 'Don't keep activities' option
  2. Open the app, Press the button to jump to FlutterActivity page
  3. Turn the app to the background, open another app (several apps are better )
  4. Turn the app to foreground and the app will crash
Code sample

Demo Url: https://github.com/a1017480401/crash_demo.git

Logs

Crash Log : https://github.com/a1017480401/crash_demo/blob/main/crash_log


[√] Flutter (Channel stable, 3.3.2, on Microsoft Windows [版本 10.0.19044.2006], locale zh-CN)
    • Flutter version 3.3.2 on channel stable at D:\code\flutter\SDK\flutter_windows_3.3.0-stable\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision e3c29ec00c (9 days ago), 2022-09-14 08:46:55 -0500
    • Engine revision a4ff2c53d8
    • Dart version 2.18.1
    • DevTools version 2.15.0
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at D:\code\android\AndroidSDK
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: D:\code\android\AS\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.6)
    • Visual Studio at D:\tools\Visual Studio\2022\Components
    • Visual Studio Community 2022 version 17.1.32421.90
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\code\android\AS
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] Connected device (5 available)
    • V2055A (mobile)              • 343470231100DGT • android-arm64  • Android 11 (API 30)
    • sdk gphone64 x86 64 (mobile) • emulator-5554   • android-x64    • Android 12 (API 31) (emulator)
    • Windows (desktop)            • windows         • windows-x64    • Microsoft Windows [版本 10.0.19044.2006]
    • Chrome (web)                 • chrome          • web-javascript • Google Chrome 105.0.5195.127
    • Edge (web)                   • edge            • web-javascript • Microsoft Edge 105.0.1343.27

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Activity

  1. Passer-by commented on Sep 23, 2022

    @Passer-by
    Author

    similar with this issue #103870

    I've made some special handle for this issue

    https://github.com/a1017480401/crash_demo/blob/main/android/app/src/main/kotlin/com/example/crash_demo/MainActivity.kt#L11-L13

    FlutterRenderer.onTrimMemory seems to be from flutter-team-archive/engine@031fa76

  2. added
    in triagePresently being triaged by the triage team
    on Sep 23, 2022
  3. exaby73 commented on Sep 23, 2022

    @exaby73
    Member

    Trying to run the android project, I get the following error.

    2022-09-23 18:38:32.527 12234-12258/com.google.android.gsf W/GmsClient: IGmsServiceBroker.getService failed
        android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
            at android.os.BinderProxy.transactNative(Native Method)
            at android.os.BinderProxy.transact(BinderProxy.java:584)
            at com.google.android.gms.common.internal.IGmsServiceBroker$Stub$zza.getService(IGmsServiceBroker.java:13)
            at com.google.android.gms.common.internal.zzr.zza(GmsClientTracer.java:3)
            at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(BaseGmsClient.java:269)
            at com.google.android.gms.common.api.internal.zzbb.run(GoogleApiManager.java:11)
            at android.os.Handler.handleCallback(Handler.java:942)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at com.google.android.gms.libs.punchclock.threads.TracingHandler.dispatchMessageTraced(TracingHandler.java:14)
            at com.google.android.gms.libs.punchclock.threads.TracingHandler.dispatchMessage(TracingHandler.java:12)
            at android.os.Looper.loopOnce(Looper.java:201)
            at android.os.Looper.loop(Looper.java:288)
            at android.os.HandlerThread.run(HandlerThread.java:67)
    

    Not sure what the issue is. But I'll still label this issue for further insights from the team.

  4. added
    c: crashStack traces logged to the console
    platform-androidAndroid applications specifically
    engineflutter/engine related. See also e: labels.
    a: platform-viewsEmbedding Android/iOS views in Flutter apps
    c: fatal crashCrashes that terminate the process
    and removed
    in triagePresently being triaged by the triage team
    on Sep 23, 2022
  5. Passer-by commented on Sep 23, 2022

    @Passer-by
    Author

    Trying to run the android project, I get the following error.

    2022-09-23 18:38:32.527 12234-12258/com.google.android.gsf W/GmsClient: IGmsServiceBroker.getService failed
        android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
            at android.os.BinderProxy.transactNative(Native Method)
            at android.os.BinderProxy.transact(BinderProxy.java:584)
            at com.google.android.gms.common.internal.IGmsServiceBroker$Stub$zza.getService(IGmsServiceBroker.java:13)
            at com.google.android.gms.common.internal.zzr.zza(GmsClientTracer.java:3)
            at com.google.android.gms.common.internal.BaseGmsClient.getRemoteService(BaseGmsClient.java:269)
            at com.google.android.gms.common.api.internal.zzbb.run(GoogleApiManager.java:11)
            at android.os.Handler.handleCallback(Handler.java:942)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at com.google.android.gms.libs.punchclock.threads.TracingHandler.dispatchMessageTraced(TracingHandler.java:14)
            at com.google.android.gms.libs.punchclock.threads.TracingHandler.dispatchMessage(TracingHandler.java:12)
            at android.os.Looper.loopOnce(Looper.java:201)
            at android.os.Looper.loop(Looper.java:288)
            at android.os.HandlerThread.run(HandlerThread.java:67)
    

    Not sure what the issue is. But I'll still label this issue for further insights from the team.

    Sorry, this crash is not the same as mine and I think this crash has nothing to do with Flutter

  6. exaby73 commented on Sep 23, 2022

    @exaby73
    Member

    This crash is appearing when clicking on the button and the Flutter view loads. Not in the way you are describing :)

  7. Passer-by commented on Sep 23, 2022

    @Passer-by
    Author

    This crash is appearing when clicking on the button and the Flutter view loads. Not in the way you are describing :)

    wait for me to try my demo again

  8. Passer-by commented on Sep 23, 2022

    @Passer-by
    Author
    48EFB7978BB91E88218423712C4835B5.mp4
  9. Passer-by commented on Sep 25, 2022

    @Passer-by
    Author

    This crash is appearing when clicking on the button and the Flutter view loads. Not in the way you are describing :)

    I apologize for my carelessness.
    I updated the demo(webview_flutter -> inappwebview add network permissions ) and provided a video of the crash

  10. exaby73 commented on Sep 26, 2022

    @exaby73
    Member

    These are the error logs I am getting after using your latest code. Though the app is crashing before I actually get into the foreground (observed through the terminal).

    Logs (tail)
    W/GmsClient( 9214): IGmsServiceBroker.getService failed
    W/GmsClient( 9214): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
    W/GmsClient( 9214):     at android.os.BinderProxy.transactNative(Native Method)
    W/GmsClient( 9214):     at android.os.BinderProxy.transact(BinderProxy.java:584)
    W/GmsClient( 9214):     at WE.b(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:288)
    W/GmsClient( 9214):     at com.google.android.gms.common.internal.BaseGmsClient.p(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:53)
    W/GmsClient( 9214):     at BB.run(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:1849)
    W/GmsClient( 9214):     at android.os.Handler.handleCallback(Handler.java:942)
    W/GmsClient( 9214):     at android.os.Handler.dispatchMessage(Handler.java:99)
    W/GmsClient( 9214):     at Sp0.dispatchMessage(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:223)
    W/GmsClient( 9214):     at android.os.Looper.loopOnce(Looper.java:201)
    W/GmsClient( 9214):     at android.os.Looper.loop(Looper.java:288)
    W/GmsClient( 9214):     at android.os.HandlerThread.run(HandlerThread.java:67)
    E/JavaBinder( 9214): !!! FAILED BINDER TRANSACTION !!!  (parcel size = 328)
    W/GmsClient( 9214): IGmsServiceBroker.getService failed
    W/GmsClient( 9214): android.os.DeadObjectException: Transaction failed on small parcel; remote process probably died, but this could also be caused by running out of binder buffe
    W/GmsClient( 9214):     at android.os.BinderProxy.transactNative(Native Method)
    W/GmsClient( 9214):     at android.os.BinderProxy.transact(BinderProxy.java:584)
    W/GmsClient( 9214):     at WE.b(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:288)
    W/GmsClient( 9214):     at com.google.android.gms.common.internal.BaseGmsClient.p(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:53)
    W/GmsClient( 9214):     at BB.run(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:1849)
    W/GmsClient( 9214):     at android.os.Handler.handleCallback(Handler.java:942)
    W/GmsClient( 9214):     at android.os.Handler.dispatchMessage(Handler.java:99)
    W/GmsClient( 9214):     at Sp0.dispatchMessage(chromium-TrichromeWebViewGoogle6432.apk-stable-495157437:223)
    W/GmsClient( 9214):     at android.os.Looper.loopOnce(Looper.java:201)
    W/GmsClient( 9214):     at android.os.Looper.loop(Looper.java:288)
    W/GmsClient( 9214):     at android.os.HandlerThread.run(HandlerThread.java:67)
    E/cr_PlatformSer-Internal( 9214): Unable to determine Safe Browsing user opt-in preference
    W/cr_ChildProcessConn( 9214): onServiceDisconnected (crash or killed by oom): pid=9367 bindings:W  S
    E/chromium( 9214): [ERROR:aw_browser_terminator.cc(156)] Renderer process (9367) crash detected (code -1).
    E/chromium( 9214): [ERROR:aw_browser_terminator.cc(112)] Render process (9367) kill (OOM or update) wasn't handed by all associated webviews, killing application.
    Lost connection to device.
    
  11. 59 remaining items

  12. felipecastrosales commented on Apr 30, 2024

    @felipecastrosales

    Hi @chinmaygarde.

    I saw you marked it as P2, shouldn't this be marked as P0? Considering the numerous appearances and reports about this problem and the consequence of it (crash in production)?

    Also, I find it very suspicious because it appeared from 3.3.0 onwards; Was there any specific change that caused this?

  13. johnmccutchan commented on Apr 30, 2024

    @johnmccutchan
    Contributor

    @felipecastrosales This is a device-specific bug that no one can reproduce except for some users in the wild running off-brand Android phones.

    Until we have a reproduction that the Flutter team can use progress will be slow.

  14. johnmccutchan commented on Apr 30, 2024

    @johnmccutchan
    Contributor

    @YuxuanDu have you tried reproducing against the latest 3.22 beta ?

    Nah, I don't have an actual Vivo device to replicate. But I am monitoring the issue using bug reporting tools. I downgraded Flutter to 3.16.9 and applied the workaround (the "wrong" one), the issue above seems to be resolved. So far I haven't got new report on this issue for the new build since the last week (after it was released). @johnmccutchan

    A more interesting experiment would be to see if it still happens in 3.22

  15. fernan88 commented on Apr 30, 2024

    @fernan88

    @johnmccutchan The steps to reproduce are outlined above (#112254 (comment)) the only requirement is to use one of the listed devices(Samsung SM-A032M, MotoG13, MotoG23).

    The issue persists in Flutter 3.19.6 but we have tried in Flutter 3.22.0-0.3.pre and is not crashing anymore in the Samsung SM-A032M device.

    @johnmccutchan would you validate this fix please? because we need to solve this as soon as possible (we have 4k affected user in 10 days and 1k crashes everyday).

  16. johnmccutchan commented on Apr 30, 2024

    @johnmccutchan
    Contributor

    Sounds like this is fixed in 3.22, we recommend people upgrade.

  17. YuxuanDu commented on Apr 30, 2024

    @YuxuanDu

    It's good to hear it has been fixed in 3.22. Another question would be when will 3.22 be released on Stable channel. @johnmccutchan

  18. westy92 commented on Apr 30, 2024

    @westy92
    Contributor

    @YuxuanDu based on history, it will be released by 5/14 for Google I/O.

  19. Gilianp commented on May 1, 2024

    @Gilianp

    I hope this bug has finally been fixed. Although few devices are affected, such devices have a large number of users, especially Samsung. With me, according to Play Console, only the Samsung A03 Core, in production, raises the crash rate above the tolerated limit of 8%, making the app subject to punishment

  20. mmga commented on May 6, 2024

    @mmga

    The issue persists in Flutter 3.19.6 but we have tried in Flutter 3.22.0-0.3.pre and is not crashing anymore in the Samsung SM-A032M device.

    @fernan88 Hi, what is the Android version of your SM-A032 device ?

  21. fernan88 commented on May 6, 2024

    @fernan88

    The issue persists in Flutter 3.19.6 but we have tried in Flutter 3.22.0-0.3.pre and is not crashing anymore in the Samsung SM-A032M device.

    @fernan88 Hi, what is the Android version of your SM-A032 device ?

    Hi Bian, this is an Android 13 OS.

  22. Gilianp commented on May 13, 2024

    @Gilianp

    3.22 is now released in stable

  23. github-actions commented on May 28, 2024

    @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.

  24. locked as resolved and limited conversation to collaborators on May 28, 2024
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 lista: platform-viewsEmbedding Android/iOS views in Flutter appsc: crashStack traces logged to the consolec: fatal crashCrashes that terminate the processcustomer: triviae: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions