drawRenderNode called on a context with no surface!

This issue has been tracked since 2022-09-23.

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!

a1017480401 wrote this answer on 2022-09-23

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/[email protected]031fa76

exaby73 wrote this answer on 2022-09-23

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.

a1017480401 wrote this answer on 2022-09-23

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

exaby73 wrote this answer on 2022-09-23

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

a1017480401 wrote this answer on 2022-09-23

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

a1017480401 wrote this answer on 2022-09-23
48EFB7978BB91E88218423712C4835B5.mp4
a1017480401 wrote this answer on 2022-09-23

单击按钮并加载 Flutter 视图时会出现此崩溃。不是你描述的方式:)

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

a1017480401 wrote this answer on 2022-09-25

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

exaby73 wrote this answer on 2022-09-26

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.
a1017480401 wrote this answer on 2022-09-29

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)

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

Try this, will it still crash ?

exaby73 wrote this answer on 2022-09-29

Already have that commented with the code I used to reproduce :D

More Details About Repo
Owner Name flutter
Repo Name flutter
Full Name flutter/flutter
Language Dart
Created Date 2015-03-06
Updated Date 2022-10-04
Star Count 145499
Watcher Count 3567
Fork Count 23393
Issue Count 11206

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date