flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.14k stars 27.46k forks source link

drawRenderNode called on a context with no surface! #112254

Closed Passer-by closed 6 months ago

Passer-by commented 2 years ago

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! ``` ```
Passer-by commented 2 years ago

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 https://github.com/flutter/engine/commit/031fa76

exaby73 commented 2 years ago

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.

Passer-by commented 2 years ago

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 commented 2 years ago

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

Passer-by commented 2 years ago

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

Passer-by commented 2 years ago

https://user-images.githubusercontent.com/58846244/192003116-da029b40-ea69-4f4a-8ed7-01c13b3adef3.mp4

Passer-by commented 2 years ago

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 commented 2 years ago

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. ```
Passer-by commented 2 years ago

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 commented 2 years ago

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

westy92 commented 1 year ago

This crash is happening for me on Flutter 3.7.0. It's only happening is the background on Motorolla devices running Android 11. I'm using the google_mobile_ads plugin.

image

Stack trace:

drawRenderNode called on a context with no surface!
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 12847 >>> com.redacted.redacted <<<

backtrace:
  #00  pc 0x000000000004e30c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000055f660  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2308)
  #02  pc 0x0000000000013978  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
  #03  pc 0x0000000000006e18  /system/lib64/liblog.so (__android_log_assert+336)
  #04  pc 0x000000000021502c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+52)
  #05  pc 0x000000000021e0e8  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+188)
  #06  pc 0x0000000000220770  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+480)
  #07  pc 0x000000000020edac  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+220)
  #08  pc 0x00000000002301f8  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+88)
  #09  pc 0x00000000000154d0  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+260)
  #10  pc 0x0000000000014d94  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+412)
  #11  pc 0x00000000000afc6c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #12  pc 0x00000000000502c8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
Passer-by commented 1 year ago

This crash is happening for me on Flutter 3.7.0. It's only happening is the background on Motorolla devices running Android 11. I'm using the google_mobile_ads plugin. image

Stack trace:

drawRenderNode called on a context with no surface!
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 12847 >>> com.redacted.redacted <<<

backtrace:
  #00  pc 0x000000000004e30c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000055f660  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2308)
  #02  pc 0x0000000000013978  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
  #03  pc 0x0000000000006e18  /system/lib64/liblog.so (__android_log_assert+336)
  #04  pc 0x000000000021502c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+52)
  #05  pc 0x000000000021e0e8  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+188)
  #06  pc 0x0000000000220770  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+480)
  #07  pc 0x000000000020edac  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+220)
  #08  pc 0x00000000002301f8  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+88)
  #09  pc 0x00000000000154d0  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+260)
  #10  pc 0x0000000000014d94  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+412)
  #11  pc 0x00000000000afc6c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #12  pc 0x00000000000502c8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

https://github.com/a1017480401/crash_demo/blob/main/android/app/src/main/kotlin/com/example/crash_demo/MainActivity.kt#L11-L13 try this,for me this is useful

KaelTeck commented 1 year ago

I'm experiencing the same crashes on Flutter 3.10.1. I've attached a screenshot of the error message and the stack trace below:

image

Stack trace: Thread

drawRenderNode called on a context with no surface!
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 840 >>> com.freresmensah.imagesearch <<<

backtrace:
  #00  pc 0x000000000008cd50  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000053210c  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2340)
  #02  pc 0x000000000001394c  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
  #03  pc 0x0000000000006d28  /system/lib64/liblog.so (__android_log_assert+336)
  #04  pc 0x000000000021a32c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+52)
  #05  pc 0x0000000000222ca0  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+404)
  #06  pc 0x00000000002251a4  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+524)
  #07  pc 0x0000000000213874  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+208)
  #08  pc 0x000000000023585c  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+88)
  #09  pc 0x0000000000015540  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+320)
  #10  pc 0x0000000000014db4  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+408)
  #11  pc 0x00000000000f450c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #12  pc 0x000000000008ef34  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

I'm unable to reproduce the issue, but I've noticed that every time a webview instance is called (such as when Google Ads is loaded and displayed or when I open an in-app webpage), this message appears in the console in debug mode on real device:

W/ACodec  ( 1334): [OMX.MTK.VIDEO.DECODER.AVC] setting nBufferCountActual to 13 failed: -22
E/libc    ( 1334): Access denied finding property "vendor.debug.bq.dump"

I'm not sure if this is related to the issue.

fisherjoe commented 1 year ago

I also encountered this problem. When I use flutter_webivew, I retreat to the background, and then use other apps until the memory of the Android system is tight. At this time, when I reopen flutter_webivew to the foreground, it will crash.

Abort message: 'drawRenderNode called on a context with no surface!' x0 0000000000000000 x1 0000000000007869 x2 0000000000000006 x3 00000077a98f2420 x4 feff71647164636d x5 feff71647164636d x6 feff71647164636d x7 7f7f7f7f7f7f7f7f x8 00000000000000f0 x9 00000078959b9520 x10 0000000000000000 x11 0000000000000001 x12 0000000000000018 x13 ffffffffffffffff x14 0000000000000004 x15 ffffffffffffffff x16 0000007895a868c8 x17 0000007895a63ce0 x18 000000779e456000 x19 00000000000077c5 x20 0000000000007869 x21 00000000ffffffff x22 0000007774f20128 x23 00000077a98f3018 x24 000000789661f098 x25 000000789661c028 x26 0000000000000001 x27 0000007774f20240 x28 00000077a98f3018 x29 00000077a98f24c0 sp 00000077a98f2400 lr 0000007895a17c00 pc 0000007895a17c30

backtrace:

00 pc 0000000000082c30 /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: f5ba4e7e3cee771446d26d581339d879)

  #01 pc 0000000000008a00  /system/lib64/liblog.so (__android_log_assert+324) (BuildId: f602e34dd90ed1ac8367e17bd391f4cf)
  #02 pc 00000000003beddc  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+48) (BuildId: f617615332e02315e20999f8c5b1b25f)
  #03 pc 00000000003c87a4  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+176) (BuildId: f617615332e02315e20999f8c5b1b25f)
  #04 pc 00000000003c79a4  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+216) (BuildId: f617615332e02315e20999f8c5b1b25f)
  #05 pc 00000000003da7fc  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+228) (BuildId: f617615332e02315e20999f8c5b1b25f)
  #06 pc 00000000003da530  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+80) (BuildId: f617615332e02315e20999f8c5b1b25f)
  #07 pc 00000000000135b0  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+288) (BuildId: 3bbc3483603a593c41a9af78d8812c9d)
  #08 pc 00000000000e2ce8  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: f5ba4e7e3cee771446d26d581339d879)
  #09 pc 0000000000084dac  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: f5ba4e7e3cee771446d26d581339d879)
batuhansavas-yilmaz commented 1 year ago

I have the same problem, how can I solve it?

libc.so] abort
SIGABRT

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 9786 >>> com.bsavasy.textrec <<<

backtrace:
  #00  pc 0x000000000004e178  /apex/com.android.runtime/lib64/bionic/libc.so (abort+168)
  #01  pc 0x0000000000552798  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2260)
  #02  pc 0x0000000000013990  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
  #03  pc 0x0000000000006e58  /system/lib64/liblog.so (__android_log_assert+336)
  #04  pc 0x00000000002153bc  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+52)
  #05  pc 0x000000000021e30c  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+404)
  #06  pc 0x000000000022091c  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+496)
  #07  pc 0x000000000020f140  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+220)
  #08  pc 0x0000000000230144  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+88)
  #09  pc 0x0000000000015414  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+260)
  #10  pc 0x0000000000014cd8  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+412)
  #11  pc 0x00000000000af97c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #12  pc 0x00000000000500d0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
batuhansavas-yilmaz commented 1 year ago

I think the problem is that : the android web view package on the users' devices is outdated, I think the problem will be fixed if the user updates the android web view via google play.

Passer-by commented 1 year ago

I think the problem is that : the android web view package on the users' devices is outdated, I think the problem will be fixed if the user updates the android web view via google play.

The actual reason is that the Activity was terminated due to insufficient memory, but the SurfaceView used by the PlatformView was not reset. As a result, when the Activity is recreated, it attempts to use the old SurfaceView which has already been garbage collected, leading to a null pointer exception. So, in situations where savedInstanceState is not null, I manually performed a cleanup to deallocate resources. like https://github.com/a1017480401/crash_demo/blob/main/android/app/src/main/kotlin/com/example/crash_demo/MainActivity.kt#L11-L13

batuhansavas-yilmaz commented 1 year ago

What exactly am I supposed to do now?

Do I need to paste this in its entirety into my mainactivity file?

package com.example.crash_demo

import android.content.Context
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        if (savedInstanceState != null) {
//            MyApplication.flutterEngine.renderer.onTrimMemory(TRIM_MEMORY_COMPLETE)
//        }
    }

    override fun provideFlutterEngine(context: Context): FlutterEngine? {
        return MyApplication.flutterEngine
    }
}
batuhansavas-yilmaz commented 1 year ago

It's mine activty. I dont understand ?

package com.bsavasy.textrec

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
Passer-by commented 1 year ago

It's mine activty. I dont understand ?

package com.bsavasy.textrec

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}

override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (savedInstanceState != null) { flutterEngine?.renderer?.onTrimMemory(TRIM_MEMORY_COMPLETE) } }

batuhansavas-yilmaz commented 1 year ago

is it ?

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (savedInstanceState != null) {
flutterEngine?.renderer?.onTrimMemory(TRIM_MEMORY_COMPLETE)
}
}}
Passer-by commented 1 year ago

is it ?

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (savedInstanceState != null) {
flutterEngine?.renderer?.onTrimMemory(TRIM_MEMORY_COMPLETE)
}
}}

import android.os.Bundle import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (savedInstanceState != null) { flutterEngine?.renderer?.onTrimMemory(TRIM_MEMORY_COMPLETE) } } }

Passer-by commented 1 year ago

@batuhansavas-yilmaz Certainly, I cannot guarantee its effectiveness for you. It's essential to ensure that your app undergoes thorough testing to verify that the existing flow works flawlessly before proceeding with this solution.

batuhansavas-yilmaz commented 1 year ago

Just out of curiosity, what does this code do in its entirety?

import android.content.Context
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine

class MainActivity : FlutterActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        if (savedInstanceState != null) {
//            MyApplication.flutterEngine.renderer.onTrimMemory(TRIM_MEMORY_COMPLETE)
//        }
    }

    override fun provideFlutterEngine(context: Context): FlutterEngine? {
        return MyApplication.flutterEngine
    }
}
Passer-by commented 1 year ago

When the Activity is recreate, simulate a low memory situation to trigger Flutter to deallocate Platform-related objects. This should be thoroughly tested, especially for orientation changes, to ensure proper functionality.

batuhansavas-yilmaz commented 1 year ago

How can I test it?

Passer-by commented 1 year ago

Please test the functionality of your application when switching between portrait and landscape orientations on the WebView interface to ensure it functions correctly.

batuhansavas-yilmaz commented 1 year ago

my application only in vertical directional use

Passer-by commented 1 year ago

If you were an Android developer, you could consider the following situations that could lead to Activity recreation.

batuhansavas-yilmaz commented 1 year ago

I'am little little developer for flutter 🤗

Passer-by commented 1 year ago

I'am little little developer for flutter 🤗

I don't recommend you to use my method because it carries certain risks.

Passer-by commented 1 year ago

I think the problem is that : the android web view package on the users' devices is outdated, I think the problem will be fixed if the user updates the android web view via google play.

The actual reason is that the Activity was terminated due to insufficient memory, but the SurfaceView used by the PlatformView was not reset. As a result, when the Activity is recreated, it attempts to use the old SurfaceView which has already been garbage collected, leading to a null pointer exception. So, in situations where savedInstanceState is not null, I manually performed a cleanup to deallocate resources. like https://github.com/a1017480401/crash_demo/blob/main/android/app/src/main/kotlin/com/example/crash_demo/MainActivity.kt#L11-L13

@chinmaygarde Hello, Chinmaygarde. Would you be available to reassess this issue? This is just my personal analysis, more and more people are encountering this issue.

batuhansavas-yilmaz commented 1 year ago

Yes @chinmaygarde, please

batuhansavas-yilmaz commented 1 year ago

I'am little little developer for flutter 🤗

I don't recommend you to use my method because it carries certain risks.

What risks does it carry?

freemanzk commented 1 year ago

This is already the one that crashes the most in my app.

freemanzk commented 1 year ago

I'am little little developer for flutter 🤗

I don't recommend you to use my method because it carries certain risks.

What risks?

edigun-man commented 11 months ago
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 27553

backtrace:
  #00  pc 0x000000000008cd50  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164)
  #01  pc 0x000000000053210c  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2340)
  #02  pc 0x000000000001394c  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
  #03  pc 0x0000000000006d28  /system/lib64/liblog.so (__android_log_assert+336)
  #04  pc 0x000000000021a32c  /system/lib64/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+52)
  #05  pc 0x0000000000222ca0  /system/lib64/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+404)
  #06  pc 0x00000000002251a4  /system/lib64/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c303f2d2360db58ed70a2d0ac7ed911b+524)
  #07  pc 0x0000000000213874  /system/lib64/libhwui.so (android::uirenderer::WorkQueue::process()+208)
  #08  pc 0x000000000023585c  /system/lib64/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+88)
  #09  pc 0x0000000000015540  /system/lib64/libutils.so (android::Thread::_threadLoop(void*)+320)
  #10  pc 0x0000000000014db4  /system/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+408)
  #11  pc 0x00000000000f450c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+64)
  #12  pc 0x000000000008ef34  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

Any news for this? I rewrite my whole app from unity to flutter because its more light, responsive, and under the hood support android but this ANR crash rate just unbearable. in Unity crash rate just 1-5 affected user/month but flutter just like 20-50 affected user/month.

Gilianp commented 10 months ago

Same here. this is one of the most frequently crashes reported by play console for my app

pablorengo commented 7 months ago

Hi! I'm having the same issue on certain devices like Samsung A03 Core and Motorola e22i. A solution was implemented for this issue, but could it be possible that these manufacturers modified the OS to clean the Surface at a lower memory trim level? The first fix in Flutter was if (level == 80) recreate surface. Maybe that value is lower in these devices.

pablorengo commented 7 months ago

Hi! We test an example project on the Samsung A03 Core (SM-A032M) with Android 12. As you can see in the video we can reproduce the crash when the memory alert is 60, while in the Flutter code there's a hardcoded 80 added to fix this same issue on most devices (previous comment).

Steps to reproduce

  1. Run the example project on the affected device
  2. Send application to background
  3. Trigger the memory alert with adb shell am send-trim-memory com.example.platform_view_crash 60
  4. Open the app again and it will crash

Example video

https://github.com/flutter/flutter/assets/2294911/7d92ea69-f09f-473c-9314-636e2c9bd30c

Code Sample in this repo

Flutter doctor ``` [✓] Flutter (Channel stable, 3.19.3, on macOS 14.2 23C64 darwin-arm64, locale en-AR) • Flutter version 3.19.3 on channel stable at /Users/pablo/dev/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision ba39319843 (13 days ago), 2024-03-07 15:22:21 -0600 • Engine revision 2e4ba9c6fb • Dart version 3.3.1 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/pablo/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/pablo/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C65 • CocoaPods version 1.13.0 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 17.0.9+0-17.0.9b1087.7-11185874) [✓] IntelliJ IDEA Ultimate Edition (version 2023.3.2) • IntelliJ at /Applications/IntelliJ IDEA.app • 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 [✓] VS Code (version 1.86.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension can be installed from: 🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter [✓] Connected device (3 available) • SM A032M (mobile) • R7MRC05XLRR • android-arm • Android 12 (API 31) • macOS (desktop) • macos • darwin-arm64 • macOS 14.2 23C64 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.129 [✓] Network resources • All expected network resources are available. • No issues found! ```
Crash log ``` 2024-03-20 12:03:46.575 11544-11567 OpenGLRenderer com.example.platform_view_crash A drawRenderNode called on a context with no surface! 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] Runtime aborting... runtime.cc:669] Dumping all threads without mutator lock held runtime.cc:669] All threads: runtime.cc:669] DALVIK THREADS (23): runtime.cc:669] "RenderThread" prio=10 tid=18 Runnable runtime.cc:669] | group="" sCount=0 ucsCount=0 flags=0 obj=0x12d80580 self=0xe71af400 runtime.cc:669] | sysTid=11567 nice=-10 cgrp=default sched=0/0 handle=0xbf91b1c0 runtime.cc:669] | state=R schedstat=( 251241536 31846198 510 ) utm=17 stm=7 core=5 HZ=100 runtime.cc:669] | stack=0xbf820000-0xbf822000 stackSize=1004KB runtime.cc:669] | held mutexes= "abort lock" "mutator lock"(shared held) runtime.cc:669] native: #00 pc 003713d5 /apex/com.android.art/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+76) runtime.cc:669] native: #01 pc 0044714f /apex/com.android.art/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream >&, bool, BacktraceMap*, bool) const+214) runtime.cc:669] native: #02 pc 0045e58d /apex/com.android.art/lib/libart.so (art::DumpCheckpoint::Run(art::Thread*)+640) runtime.cc:669] native: #03 pc 00459bad /apex/com.android.art/lib/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+348) runtime.cc:669] native: #04 pc 0045912d /apex/com.android.art/lib/libart.so (art::ThreadList::Dump(std::__1::basic_ostream >&, bool)+1204) runtime.cc:669] native: #05 pc 00407191 /apex/com.android.art/lib/libart.so (art::Runtime::Abort(char const*)+1708) runtime.cc:669] native: #06 pc 0000f5db /system/lib/libbase.so (android::base::SetAborter(std::__1::function&&)::$_3::__invoke(char const*)+46) runtime.cc:669] native: #07 pc 00004f87 /system/lib/liblog.so (__android_log_assert+158) runtime.cc:669] native: #08 pc 001db363 /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+26) runtime.cc:669] native: #09 pc 00225a0d /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+284) runtime.cc:669] native: #10 pc 00224dad /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c1671e787f244890c877724752face20+624) runtime.cc:669] native: #11 pc 0022f0f5 /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+112) runtime.cc:669] native: #12 pc 0022ef71 /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+52) runtime.cc:669] native: #13 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #14 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #15 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #16 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "main" prio=10 tid=1 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x710656a8 self=0xe9fb4e00 runtime.cc:669] | sysTid=11544 nice=-10 cgrp=default sched=0/0 handle=0xea5354f4 runtime.cc:669] | state=S schedstat=( 1705126153 76494882 1028 ) utm=149 stm=20 core=7 HZ=100 runtime.cc:669] | stack=0xff539000-0xff53b000 stackSize=8188KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0006184d /apex/com.android.runtime/lib/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+92) runtime.cc:669] native: #02 pc 000a82d5 /apex/com.android.runtime/lib/bionic/libc.so (pthread_cond_wait+32) 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #03 pc 0021035f /system/lib/libhwui.so (android::uirenderer::renderthread::DrawFrameTask::postAndWait()+154) runtime.cc:669] native: #04 pc 0021029f /system/lib/libhwui.so (android::uirenderer::renderthread::RenderProxy::syncAndDrawFrame()+26) runtime.cc:669] at android.graphics.HardwareRenderer.nSyncAndDrawFrame(Native method) runtime.cc:669] at android.graphics.HardwareRenderer.syncAndDrawFrame(HardwareRenderer.java:456) runtime.cc:669] at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:634) runtime.cc:669] at android.view.ViewRootImpl.draw(ViewRootImpl.java:4453) runtime.cc:669] at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4181) runtime.cc:669] at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3341) runtime.cc:669] at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2153) runtime.cc:669] at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8685) runtime.cc:669] at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037) runtime.cc:669] at android.view.Choreographer.doCallbacks(Choreographer.java:845) runtime.cc:669] at android.view.Choreographer.doFrame(Choreographer.java:780) runtime.cc:669] at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022) runtime.cc:669] at android.os.Handler.handleCallback(Handler.java:938) runtime.cc:669] at android.os.Handler.dispatchMessage(Handler.java:99) runtime.cc:669] at android.os.Looper.loopOnce(Looper.java:201) runtime.cc:669] at android.os.Looper.loop(Looper.java:288) runtime.cc:669] at android.app.ActivityThread.main(ActivityThread.java:7952) runtime.cc:669] at java.lang.reflect.Method.invoke(Native method) runtime.cc:669] at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) runtime.cc:669] at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1022) runtime.cc:669] runtime.cc:669] "Signal Catcher" prio=10 tid=6 WaitingInMainSignalCatcherLoop runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d800d0 self=0xe9fb9400 runtime.cc:669] | sysTid=11555 nice=-20 cgrp=default sched=0/0 handle=0xd30dc1c0 runtime.cc:669] | state=S schedstat=( 715077 0 1 ) utm=0 stm=0 core=6 HZ=100 runtime.cc:669] | stack=0xd2fe1000-0xd2fe3000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009a0c0 /apex/com.android.runtime/lib/bionic/libc.so (__rt_sigtimedwait+12) runtime.cc:669] native: #01 pc 0006aae3 /apex/com.android.runtime/lib/bionic/libc.so (sigwait64+58) runtime.cc:669] native: #02 pc 00423edd /apex/com.android.art/lib/libart.so (art::SignalCatcher::WaitForSignal(art::Thread*, art::SignalSet&)+192) runtime.cc:669] native: #03 pc 00423051 /apex/com.android.art/lib/libart.so (art::SignalCatcher::Run(void*)+192) runtime.cc:669] native: #04 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #05 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "perfetto_hprof_listener" prio=10 tid=7 Native (still starting up) runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x0 self=0xe8cb6a00 runtime.cc:669] | sysTid=11556 nice=-20 cgrp=default sched=0/0 handle=0xd2fdb1c0 runtime.cc:669] | state=S schedstat=( 537345 16384 6 ) utm=0 stm=0 core=6 HZ=100 runtime.cc:669] | stack=0xd2ee0000-0xd2ee2000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009930c /apex/com.android.runtime/lib/bionic/libc.so (read+8) runtime.cc:669] native: #01 pc 000102a7 /apex/com.android.art/lib/libperfetto_hprof.so (void* std::__1::__thread_proxy >, ArtPlugin_Initialize::$_33> >(void*)+206) 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #02 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #03 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "ADB-JDWP Connection Control Thread" prio=10 tid=8 WaitingInMainDebuggerLoop runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80148 self=0xe8cb7800 runtime.cc:669] | sysTid=11557 nice=-20 cgrp=default sched=0/0 handle=0xd2eda1c0 runtime.cc:669] | state=S schedstat=( 5773578 695692 5 ) utm=0 stm=0 core=1 HZ=100 runtime.cc:669] | stack=0xd2ddf000-0xd2de1000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009a7c8 /apex/com.android.runtime/lib/bionic/libc.so (__ppoll+20) runtime.cc:669] native: #01 pc 00068d9f /apex/com.android.runtime/lib/bionic/libc.so (poll+54) runtime.cc:669] native: #02 pc 00007d77 /apex/com.android.art/lib/libadbconnection.so (adbconnection::AdbConnectionState::RunPollLoop(art::Thread*)+602) runtime.cc:669] native: #03 pc 00006a67 /apex/com.android.art/lib/libadbconnection.so (adbconnection::CallbackFunction(void*)+1098) runtime.cc:669] native: #04 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #05 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "Jit thread pool worker thread 0" prio=5 tid=9 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d801c0 self=0xe8cb8600 runtime.cc:669] | sysTid=11558 nice=9 cgrp=default sched=0/0 handle=0xc0be01c0 runtime.cc:669] | state=S schedstat=( 260103651 31237921 167 ) utm=22 stm=3 core=5 HZ=100 runtime.cc:669] | stack=0xc0ae1000-0xc0ae3000 stackSize=1020KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82) runtime.cc:669] native: #02 pc 0045f7f5 /apex/com.android.art/lib/libart.so (art::ThreadPool::GetTask(art::Thread*)+58) runtime.cc:669] native: #03 pc 0045f001 /apex/com.android.art/lib/libart.so (art::ThreadPoolWorker::Run()+72) runtime.cc:669] native: #04 pc 0045ec41 /apex/com.android.art/lib/libart.so (art::ThreadPoolWorker::Callback(void*)+116) runtime.cc:669] native: #05 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #06 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "HeapTaskDaemon" prio=5 tid=10 WaitingForTaskProcessor runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80b80 self=0xe8cb9400 runtime.cc:669] | sysTid=11559 nice=4 cgrp=default sched=0/0 handle=0xc0adb1c0 runtime.cc:669] | state=S schedstat=( 75156155 3373153 28 ) utm=6 stm=0 core=2 HZ=100 runtime.cc:669] | stack=0xc09d8000-0xc09da000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82) runtime.cc:669] native: #02 pc 00228e7f /apex/com.android.art/lib/libart.so (art::gc::TaskProcessor::GetTask(art::Thread*)+294) runtime.cc:669] native: #03 pc 0022952d /apex/com.android.art/lib/libart.so (art::gc::TaskProcessor::RunAllTasks(art::Thread*)+48) runtime.cc:669] at dalvik.system.VMRuntime.runHeapTasks(Native method) runtime.cc:669] at java.lang.Daemons$HeapTaskDaemon.runInternal(Daemons.java:531) runtime.cc:669] at java.lang.Daemons$Daemon.run(Daemons.java:139) 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "ReferenceQueueDaemon" prio=5 tid=11 Waiting runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80238 self=0xe8cba200 runtime.cc:669] | sysTid=11560 nice=4 cgrp=default sched=0/0 handle=0xc09d21c0 runtime.cc:669] | state=S schedstat=( 2533500 163385 11 ) utm=0 stm=0 core=3 HZ=100 runtime.cc:669] | stack=0xc08cf000-0xc08d1000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82) runtime.cc:669] native: #02 pc 0036d9cb /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+454) runtime.cc:669] native: #03 pc 0036ec0f /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, art::ObjPtr, long long, int, bool, art::ThreadState)+178) runtime.cc:669] native: #04 pc 003849b1 /apex/com.android.art/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36) runtime.cc:669] at java.lang.Object.wait(Native method) runtime.cc:669] - waiting on <0x0364f325> (a java.lang.Class) runtime.cc:669] at java.lang.Object.wait(Object.java:442) runtime.cc:669] at java.lang.Object.wait(Object.java:568) runtime.cc:669] at java.lang.Daemons$ReferenceQueueDaemon.runInternal(Daemons.java:217) runtime.cc:669] - locked <0x0364f325> (a java.lang.Class) runtime.cc:669] at java.lang.Daemons$Daemon.run(Daemons.java:139) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "FinalizerDaemon" prio=5 tid=12 Waiting runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d802b0 self=0xe71aa000 runtime.cc:669] | sysTid=11561 nice=4 cgrp=default sched=0/0 handle=0xc08c91c0 runtime.cc:669] | state=S schedstat=( 2511037 14231 8 ) utm=0 stm=0 core=1 HZ=100 runtime.cc:669] | stack=0xc07c6000-0xc07c8000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82) runtime.cc:669] native: #02 pc 0036d9cb /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+454) runtime.cc:669] native: #03 pc 0036ec0f /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, art::ObjPtr, long long, int, bool, art::ThreadState)+178) runtime.cc:669] native: #04 pc 003849b1 /apex/com.android.art/lib/libart.so (art::Object_waitJI(_JNIEnv*, _jobject*, long long, int)+36) runtime.cc:669] at java.lang.Object.wait(Native method) runtime.cc:669] - waiting on <0x07aefcfa> (a java.lang.Object) runtime.cc:669] at java.lang.Object.wait(Object.java:442) runtime.cc:669] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:190) runtime.cc:669] - locked <0x07aefcfa> (a java.lang.Object) runtime.cc:669] at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:211) runtime.cc:669] at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:273) runtime.cc:669] at java.lang.Daemons$Daemon.run(Daemons.java:139) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "FinalizerWatchdogDaemon" prio=5 tid=13 Sleeping runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80328 self=0xe71aae00 runtime.cc:669] | sysTid=11562 nice=4 cgrp=default sched=0/0 handle=0xc07c01c0 runtime.cc:669] | state=S schedstat=( 986538 23346 7 ) utm=0 stm=0 core=3 HZ=100 runtime.cc:669] | stack=0xc06bd000-0xc06bf000 stackSize=1036KB runtime.cc:669] | held mutexes= 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #00 pc 0005c0b4 /apex/com.android.runtime/lib/bionic/libc.so (syscall+32) runtime.cc:669] native: #01 pc 0014ab35 /apex/com.android.art/lib/libart.so (art::ConditionVariable::TimedWait(art::Thread*, long long, int)+108) runtime.cc:669] native: #02 pc 0036d9dd /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+472) runtime.cc:669] native: #03 pc 0036ec0f /apex/com.android.art/lib/libart.so (art::Monitor::Wait(art::Thread*, art::ObjPtr, long long, int, bool, art::ThreadState)+178) runtime.cc:669] native: #04 pc 0038a61b /apex/com.android.art/lib/libart.so (art::Thread_sleep(_JNIEnv*, _jclass*, _jobject*, long long, int)+54) runtime.cc:669] at java.lang.Thread.sleep(Native method) runtime.cc:669] - sleeping on <0x09f212ab> (a java.lang.Object) runtime.cc:669] at java.lang.Thread.sleep(Thread.java:451) runtime.cc:669] - locked <0x09f212ab> (a java.lang.Object) runtime.cc:669] at java.lang.Thread.sleep(Thread.java:356) runtime.cc:669] at java.lang.Daemons$FinalizerWatchdogDaemon.sleepForNanos(Daemons.java:390) runtime.cc:669] at java.lang.Daemons$FinalizerWatchdogDaemon.waitForFinalization(Daemons.java:419) runtime.cc:669] at java.lang.Daemons$FinalizerWatchdogDaemon.runInternal(Daemons.java:325) runtime.cc:669] at java.lang.Daemons$Daemon.run(Daemons.java:139) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "Binder:11544_1" prio=5 tid=14 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d803a0 self=0xe71abc00 runtime.cc:669] | sysTid=11563 nice=0 cgrp=default sched=0/0 handle=0xc05b91c0 runtime.cc:669] | state=S schedstat=( 1411464 93384 5 ) utm=0 stm=0 core=7 HZ=100 runtime.cc:669] | stack=0xc04be000-0xc04c0000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 000995dc /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+8) runtime.cc:669] native: #01 pc 0006732b /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) runtime.cc:669] native: #02 pc 0002ed8f /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+218) runtime.cc:669] native: #03 pc 0002ef7d /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+8) runtime.cc:669] native: #04 pc 0002f6a1 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+44) runtime.cc:669] native: #05 pc 00047f71 /system/lib/libbinder.so (android::PoolThread::threadLoop()+12) runtime.cc:669] native: #06 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #07 pc 0007f65f /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+86) runtime.cc:669] native: #08 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #09 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #10 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "Binder:11544_2" prio=5 tid=15 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80418 self=0xe71aca00 runtime.cc:669] | sysTid=11564 nice=0 cgrp=default sched=0/0 handle=0xc04b81c0 runtime.cc:669] | state=S schedstat=( 57718189 29833581 80 ) utm=4 stm=1 core=3 HZ=100 runtime.cc:669] | stack=0xc03bd000-0xc03bf000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 000995dc /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+8) runtime.cc:669] native: #01 pc 0006732b /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) runtime.cc:669] native: #02 pc 0002ed8f /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+218) 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #03 pc 0002ef7d /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+8) runtime.cc:669] native: #04 pc 0002f6a1 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+44) runtime.cc:669] native: #05 pc 00047f71 /system/lib/libbinder.so (android::PoolThread::threadLoop()+12) runtime.cc:669] native: #06 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #07 pc 0007f65f /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+86) runtime.cc:669] native: #08 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #09 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #10 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "Binder:11544_3" prio=5 tid=16 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80490 self=0xe71ad800 runtime.cc:669] | sysTid=11565 nice=0 cgrp=default sched=0/0 handle=0xc03b71c0 runtime.cc:669] | state=S schedstat=( 42185421 27527651 64 ) utm=3 stm=1 core=2 HZ=100 runtime.cc:669] | stack=0xc02bc000-0xc02be000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 000995dc /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+8) runtime.cc:669] native: #01 pc 0006732b /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) runtime.cc:669] native: #02 pc 0002ed8f /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+218) runtime.cc:669] native: #03 pc 0002ef7d /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+8) runtime.cc:669] native: #04 pc 0002f6a1 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+44) runtime.cc:669] native: #05 pc 00047f71 /system/lib/libbinder.so (android::PoolThread::threadLoop()+12) runtime.cc:669] native: #06 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #07 pc 0007f65f /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+86) runtime.cc:669] native: #08 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #09 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #10 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "Profile Saver" prio=5 tid=17 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80508 self=0xe71ae600 runtime.cc:669] | sysTid=11566 nice=9 cgrp=default sched=0/0 handle=0xbfa1c1c0 runtime.cc:669] | state=S schedstat=( 14281153 2299615 15 ) utm=1 stm=0 core=4 HZ=100 runtime.cc:669] | stack=0xbf921000-0xbf923000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0014a873 /apex/com.android.art/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+82) runtime.cc:669] native: #02 pc 00278761 /apex/com.android.art/lib/libart.so (art::ProfileSaver::Run()+424) runtime.cc:669] native: #03 pc 0027c703 /apex/com.android.art/lib/libart.so (art::ProfileSaver::RunProfileSaverThread(void*)+106) runtime.cc:669] native: #04 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #05 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "flutter-worker-0" prio=5 tid=19 TimedWaiting 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d805f8 self=0xe71b0200 runtime.cc:669] | sysTid=11570 nice=0 cgrp=default sched=0/0 handle=0xbf81a1c0 runtime.cc:669] | state=S schedstat=( 15170805 0 1 ) utm=1 stm=0 core=5 HZ=100 runtime.cc:669] | stack=0xbf717000-0xbf719000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b4 /apex/com.android.runtime/lib/bionic/libc.so (syscall+32) runtime.cc:669] native: #01 pc 0043fee7 /apex/com.android.art/lib/libart.so (art::Thread::Park(bool, long long)+1046) runtime.cc:669] native: #02 pc 00398355 /apex/com.android.art/lib/libart.so (art::Unsafe_park(_JNIEnv*, _jobject*, unsigned char, long long)+464) runtime.cc:669] at sun.misc.Unsafe.park(Native method) runtime.cc:669] - waiting on an unknown object runtime.cc:669] at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362) runtime.cc:669] at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "AsyncTask #1" prio=4 tid=20 Waiting runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80730 self=0xbfa39000 runtime.cc:669] | sysTid=11571 nice=10 cgrp=default sched=0/0 handle=0xbf7111c0 runtime.cc:669] | state=S schedstat=( 4011345 204154 2 ) utm=0 stm=0 core=6 HZ=100 runtime.cc:669] | stack=0xbf60e000-0xbf610000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0043fc51 /apex/com.android.art/lib/libart.so (art::Thread::Park(bool, long long)+384) runtime.cc:669] native: #02 pc 00398355 /apex/com.android.art/lib/libart.so (art::Unsafe_park(_JNIEnv*, _jobject*, unsigned char, long long)+464) runtime.cc:669] at sun.misc.Unsafe.park(Native method) runtime.cc:669] - waiting on an unknown object runtime.cc:669] at java.util.concurrent.locks.LockSupport.park(LockSupport.java:190) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:459) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362) runtime.cc:669] at java.util.concurrent.SynchronousQueue.take(SynchronousQueue.java:920) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1092) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "flutter-worker-1" prio=5 tid=21 TimedWaiting runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d807f8 self=0xbfa39e00 runtime.cc:669] | sysTid=11572 nice=0 cgrp=default sched=0/0 handle=0xbd54f1c0 runtime.cc:669] | state=S schedstat=( 93447703 73000 83 ) utm=7 stm=1 core=5 HZ=100 runtime.cc:669] | stack=0xbd44c000-0xbd44e000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b4 /apex/com.android.runtime/lib/bionic/libc.so (syscall+32) runtime.cc:669] native: #01 pc 0043fee7 /apex/com.android.art/lib/libart.so (art::Thread::Park(bool, long long)+1046) 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #02 pc 00398355 /apex/com.android.art/lib/libart.so (art::Unsafe_park(_JNIEnv*, _jobject*, unsigned char, long long)+464) runtime.cc:669] at sun.misc.Unsafe.park(Native method) runtime.cc:669] - waiting on an unknown object runtime.cc:669] at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:230) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:461) runtime.cc:669] at java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:362) runtime.cc:669] at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:937) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1091) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) runtime.cc:669] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) runtime.cc:669] at java.lang.Thread.run(Thread.java:920) runtime.cc:669] runtime.cc:669] "1.ui" prio=6 tid=22 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d808c0 self=0xe5b39000 runtime.cc:669] | sysTid=11573 nice=-1 cgrp=default sched=0/0 handle=0xbd4461c0 runtime.cc:669] | state=S schedstat=( 5449721143 150327152 370 ) utm=498 stm=46 core=5 HZ=100 runtime.cc:669] | stack=0xbd34b000-0xbd34d000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009a6b8 /apex/com.android.runtime/lib/bionic/libc.so (__epoll_pwait+20) runtime.cc:669] native: #01 pc 0006be59 /apex/com.android.runtime/lib/bionic/libc.so (epoll_wait+16) runtime.cc:669] native: #02 pc 000100a5 /system/lib/libutils.so (android::Looper::pollInner(int)+124) runtime.cc:669] native: #03 pc 0000ffcf /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+62) runtime.cc:669] native: #04 pc 000101ad /system/lib/libandroid.so (ALooper_pollOnce+56) runtime.cc:669] native: #05 pc 019ac3ff /data/app/~~bBgaMeqrPbb-HDu-8p6TZA==/com.example.platform_view_crash-d1-cvYbt44zT8SK0idEuTA==/lib/arm/libflutter.so (???) runtime.cc:669] native: #06 pc 019a8371 /data/app/~~bBgaMeqrPbb-HDu-8p6TZA==/com.example.platform_view_crash-d1-cvYbt44zT8SK0idEuTA==/lib/arm/libflutter.so (???) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "hwuiTask0" prio=6 tid=2 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80938 self=0xe9fb8600 runtime.cc:669] | sysTid=11587 nice=-2 cgrp=default sched=0/0 handle=0xaf3e81c0 runtime.cc:669] | state=S schedstat=( 1106540 0 3 ) utm=0 stm=0 core=7 HZ=100 runtime.cc:669] | stack=0xaf2ed000-0xaf2ef000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0006184d /apex/com.android.runtime/lib/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+92) runtime.cc:669] native: #02 pc 000a82d5 /apex/com.android.runtime/lib/bionic/libc.so (pthread_cond_wait+32) runtime.cc:669] native: #03 pc 0003d0f9 /system/lib/libc++.so (std::__1::condition_variable::wait(std::__1::unique_lock&)+8) runtime.cc:669] native: #04 pc 002a77f9 /system/lib/libhwui.so (android::uirenderer::CommonPool::workerLoop()+72) runtime.cc:669] native: #05 pc 002a7761 /system/lib/libhwui.so (void* std::__1::__thread_proxy >, android::uirenderer::CommonPool::CommonPool()::$_0> >(void*)+128) runtime.cc:669] native: #06 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #07 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "hwuiTask1" prio=6 tid=3 Native 2024-03-20 12:03:46.907 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d809b0 self=0xbfa3d600 runtime.cc:669] | sysTid=11588 nice=-2 cgrp=default sched=0/0 handle=0xaf2e71c0 runtime.cc:669] | state=S schedstat=( 1271730 0 2 ) utm=0 stm=0 core=4 HZ=100 runtime.cc:669] | stack=0xaf1ec000-0xaf1ee000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0005c0b0 /apex/com.android.runtime/lib/bionic/libc.so (syscall+28) runtime.cc:669] native: #01 pc 0006184d /apex/com.android.runtime/lib/bionic/libc.so (__futex_wait_ex(void volatile*, bool, int, bool, timespec const*)+92) runtime.cc:669] native: #02 pc 000a82d5 /apex/com.android.runtime/lib/bionic/libc.so (pthread_cond_wait+32) runtime.cc:669] native: #03 pc 0003d0f9 /system/lib/libc++.so (std::__1::condition_variable::wait(std::__1::unique_lock&)+8) runtime.cc:669] native: #04 pc 002a77f9 /system/lib/libhwui.so (android::uirenderer::CommonPool::workerLoop()+72) runtime.cc:669] native: #05 pc 002a7761 /system/lib/libhwui.so (void* std::__1::__thread_proxy >, android::uirenderer::CommonPool::CommonPool()::$_0> >(void*)+128) runtime.cc:669] native: #06 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #07 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "1.raster" prio=8 tid=4 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80a28 self=0xe5b39e00 runtime.cc:669] | sysTid=11574 nice=-5 cgrp=default sched=0/0 handle=0xbd3451c0 runtime.cc:669] | state=S schedstat=( 95506999 17463579 96 ) utm=5 stm=3 core=7 HZ=100 runtime.cc:669] | stack=0xbd24a000-0xbd24c000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009a6b8 /apex/com.android.runtime/lib/bionic/libc.so (__epoll_pwait+20) runtime.cc:669] native: #01 pc 0006be59 /apex/com.android.runtime/lib/bionic/libc.so (epoll_wait+16) runtime.cc:669] native: #02 pc 000100a5 /system/lib/libutils.so (android::Looper::pollInner(int)+124) runtime.cc:669] native: #03 pc 0000ffcf /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+62) runtime.cc:669] native: #04 pc 000101ad /system/lib/libandroid.so (ALooper_pollOnce+56) runtime.cc:669] native: #05 pc 019ac3ff /data/app/~~bBgaMeqrPbb-HDu-8p6TZA==/com.example.platform_view_crash-d1-cvYbt44zT8SK0idEuTA==/lib/arm/libflutter.so (???) runtime.cc:669] native: #06 pc 019a8371 /data/app/~~bBgaMeqrPbb-HDu-8p6TZA==/com.example.platform_view_crash-d1-cvYbt44zT8SK0idEuTA==/lib/arm/libflutter.so (???) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] "queued-work-looper" prio=6 tid=5 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d80aa0 self=0xbfa3e400 runtime.cc:669] | sysTid=11596 nice=-2 cgrp=default sched=0/0 handle=0xb07fc1c0 runtime.cc:669] | state=S schedstat=( 1087039 249269 3 ) utm=0 stm=0 core=0 HZ=100 runtime.cc:669] | stack=0xb06f9000-0xb06fb000 stackSize=1036KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 0009a6b8 /apex/com.android.runtime/lib/bionic/libc.so (__epoll_pwait+20) runtime.cc:669] native: #01 pc 0006be59 /apex/com.android.runtime/lib/bionic/libc.so (epoll_wait+16) runtime.cc:669] native: #02 pc 000100a5 /system/lib/libutils.so (android::Looper::pollInner(int)+124) runtime.cc:669] native: #03 pc 0000ffcf /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+62) runtime.cc:669] native: #04 pc 000e14b3 /system/lib/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce(_JNIEnv*, _jobject*, long long, int)+24) runtime.cc:669] at android.os.MessageQueue.nativePollOnce(Native method) 2024-03-20 12:03:46.908 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] at android.os.MessageQueue.next(MessageQueue.java:335) runtime.cc:669] at android.os.Looper.loopOnce(Looper.java:161) runtime.cc:669] at android.os.Looper.loop(Looper.java:288) runtime.cc:669] at android.os.HandlerThread.run(HandlerThread.java:67) runtime.cc:669] runtime.cc:669] "Binder:11544_4" prio=5 tid=23 Native runtime.cc:669] | group="" sCount=1 ucsCount=0 flags=1 obj=0x12d40020 self=0xbfa3c800 runtime.cc:669] | sysTid=11617 nice=0 cgrp=default sched=0/0 handle=0xb6bfc1c0 runtime.cc:669] | state=S schedstat=( 433807 0 1 ) utm=0 stm=0 core=5 HZ=100 runtime.cc:669] | stack=0xb6b01000-0xb6b03000 stackSize=1004KB runtime.cc:669] | held mutexes= runtime.cc:669] native: #00 pc 000995dc /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+8) runtime.cc:669] native: #01 pc 0006732b /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) runtime.cc:669] native: #02 pc 0002ed8f /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+218) runtime.cc:669] native: #03 pc 0002ef7d /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+8) runtime.cc:669] native: #04 pc 0002f6a1 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+44) runtime.cc:669] native: #05 pc 00047f71 /system/lib/libbinder.so (android::PoolThread::threadLoop()+12) runtime.cc:669] native: #06 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #07 pc 0007f65f /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+86) runtime.cc:669] native: #08 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #09 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #10 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] runtime.cc:669] Aborting thread: runtime.cc:669] "RenderThread" prio=10 tid=18 Native runtime.cc:669] | group="" sCount=0 ucsCount=0 flags=0 obj=0x12d80580 self=0xe71af400 runtime.cc:669] | sysTid=11567 nice=-10 cgrp=default sched=0/0 handle=0xbf91b1c0 runtime.cc:669] | state=R schedstat=( 408499375 34145621 611 ) utm=30 stm=10 core=5 HZ=100 runtime.cc:669] | stack=0xbf820000-0xbf822000 stackSize=1004KB runtime.cc:669] | held mutexes= "abort lock" runtime.cc:669] native: #00 pc 003713d5 /apex/com.android.art/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+76) runtime.cc:669] native: #01 pc 0044714f /apex/com.android.art/lib/libart.so (art::Thread::DumpStack(std::__1::basic_ostream >&, bool, BacktraceMap*, bool) const+214) runtime.cc:669] native: #02 pc 0041704b /apex/com.android.art/lib/libart.so (art::AbortState::DumpThread(std::__1::basic_ostream >&, art::Thread*) const+38) runtime.cc:669] native: #03 pc 00407227 /apex/com.android.art/lib/libart.so (art::Runtime::Abort(char const*)+1858) runtime.cc:669] native: #04 pc 0000f5db /system/lib/libbase.so (android::base::SetAborter(std::__1::function&&)::$_3::__invoke(char const*)+46) runtime.cc:669] native: #05 pc 00004f87 /system/lib/liblog.so (__android_log_assert+158) runtime.cc:669] native: #06 pc 001db363 /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::getFrame()+26) runtime.cc:669] native: #07 pc 00225a0d /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+284) runtime.cc:669] native: #08 pc 00224dad /system/lib/libhwui.so (_ZNSt3__110__function6__funcIZN7android10uirenderer12renderthread13DrawFrameTask11postAndWaitEvE3$_0NS_9allocatorIS6_EEFvvEEclEv$c1671e787f244890c877724752face20+624) 2024-03-20 12:03:46.908 11544-11567 form_view_cras com.example.platform_view_crash A runtime.cc:669] native: #09 pc 0022f0f5 /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+112) runtime.cc:669] native: #10 pc 0022ef71 /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+52) runtime.cc:669] native: #11 pc 0000d327 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+166) runtime.cc:669] native: #12 pc 0000ce67 /system/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+254) runtime.cc:669] native: #13 pc 000a8ca7 /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) runtime.cc:669] native: #14 pc 00061e85 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) runtime.cc:669] (no managed stack frames) runtime.cc:669] 2024-03-20 12:03:46.911 11544-11567 libc com.example.platform_view_crash A Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 11567 (RenderThread), pid 11544 (form_view_crash) ```
Gilianp commented 7 months ago

Hi! We test an example project on the Samsung A03 Core (SM-A032M) with Android 12. As you can see in the video we can reproduce the crash when the memory alert is 60, while in the Flutter code there's a hardcoded 80 added to fix this same issue on most devices (previous comment).

Steps to reproduce

  1. Run the example project on the affected device
  2. Send application to background
  3. Trigger the memory alert with adb shell am send-trim-memory com.example.platform_view_crash 60
  4. Open the app again and it will crash

Example video

Screen.Recording.2024-03-20.at.12.02.36.mp4 Code Sample in this repo

Flutter doctor Crash log

Hi @pablorengo! Very interesting! the galaxy A03 Core is the device that presents this crash the most in my reports. What would be a possible solution?

pablorengo commented 7 months ago

Hi @Gilianp! The right solution would be a fix in Flutter code. What we are going to do on our side to workaround this is catch every onTrimMemory event from Android and convert the level from 60 to 80, only for the devices affected.

Gilianp commented 7 months ago

Thanks for the reply @pablorengo ! I'll try this workaround and see how it goes in production. Then I will bring the results of the reports here. Thanks again, and I hope the flutter team sees your reproducible example!

Passer-by commented 7 months ago

Hi @Hixie @exaby73 @pablorengo has provided a more intuitive way to reproduce the issue, hoping to further follow up on this problem~

atrope commented 7 months ago

Hi @Gilianp! The right solution would be a fix in Flutter code. What we are going to do on our side to workaround this is catch every onTrimMemory event from Android and convert the level from 60 to 80, only for the devices affected.

It is Happening here also in lots of devices, really easy to simulate having one ad in the screen and sending the command.

To avoid in the meantime you can put this in your MainActivity.kt:

private fun isDeviceAffected(): Boolean {
    return Build.MODEL in listOf("SM-A032M", "ModelB", "ModelC")
}
override fun onTrimMemory(level: Int) {
    super.onTrimMemory(if (level == 60 && isDeviceAffected()) TRIM_MEMORY_COMPLETE else level);
}

Take in consideration that we are removing level 60 from being sent to the app. It COULD have some unexpected behaviours in devices that are not happening the crash.

IMO it should be done in the engine level like it was done with level 80

Gilianp commented 7 months ago

Hi @atrope , Thank you very much for the code. I will use it until there is an official solution!!

pablorengo commented 6 months ago

Hi! This was the impact on crashes after implementing the workaround on moto e22i and Samsung A03 Core.

image

We have more devices with this error on Crashlytics. We will be adding them to this solution even though they don't appear on Play Console.

Gilianp commented 6 months ago

Hi! This was the impact on crashes after implementing the workaround on moto e22i and Samsung A03 Core.

image

We have more devices with this error on Crashlytics. We will be adding them to this solution even though they don't appear on Play Console.

Hi @pablorengo, very good! I am now implementing this solution. Thank you for posting your result here! I put this devices:

 [ //Galaxy a03 core
  "SM-A032M", "SM-A032F",

  //Moto e22i
  "moto e22i",

  //Redmi ice
  "220733SG", "220733SI",

  //Honor HONOR X5
  "VNA-LX2", "VNA-LX3"]
pablorengo commented 6 months ago

Hi @Gilianp, bad news from my side. This workaround was implemented with Flutter 3.7.12. After upgrading to 3.19.3, the issue started occurring again, but only for SM-A032M. Additionally, two new devices are impacted: moto g13 and moto g23. I will investigate further.

YuxuanDu commented 6 months ago

Hi @Gilianp, bad news from my side. This workaround was implemented with Flutter 3.7.12. After upgrading to 3.19.3, the issue started occurring again, but only for SM-A032M. Additionally, two new devices are impacted: moto g13 and moto g23. I will investigate further.

HI @pablorengo , thank you very much for the information. I just want to double check does the temp workaround still work in 3.19.3+ ? I got the same issue, it seems that the issue also affect all Vivo devices running Funtouch OS 13. I am planning to implement the workaround you suggested if that's still a valid solution.