Skip to content

Flutter engine crashes on some Android devices due to "Failed to setup Skia Gr context" #47804

@yrom

Description

@yrom

Steps to Reproduce

This crash was happened on users' Android phone. I don't know clear steps to reproduce.

User starts the FlutterActivity then the APP crashes immediately.

Devices:

  • Huawei DUB AL00A
  • Huawei DUB AL00
  • Honor BKK AL10
  • Huawei ARS AL00
  • Huawei DUB AL20

Android version: Android 8.1.0,level 27

I noticed that they are all Huawei phones, and the EMUI version is 8.x, some of which using the Qualcomm Snapdragon processor.


updated at 2020-1-3

After investigating, I found the root cause was the skia attemping to use GL_QCOM_TILED_RENDERING on these phones. Ssee https://skia-review.googlesource.com/c/skia/+/246282/2. But something went wrong as the logcat said.

If you are troubling on this issue, you can try to roll back the skia revision and use your local compiled flutter engine, before the flutter team fixed this issue.

Logs


W libEGL : [eglGetProcAddress] QCOM code detected: glEndTilingQCOM ... Returning NULL
W libEGL : [eglGetProcAddress] QCOM code detected: glStartTilingQCOM ... Returning NULL
E flutter : [ERROR:flutter/shell/gpu/gpu_surface_gl.cc(70)] Failed to setup Skia Gr context.
W libEGL : [eglGetProcAddress] QCOM code detected: glEndTilingQCOM ... Returning NULL
W libEGL : [eglGetProcAddress] QCOM code detected: glStartTilingQCOM ... Returning NULL

main thread stack trace:

1 io.flutter.embedding.engine.FlutterJNI.nativeSurfaceCreated(Native Method)
2 io.flutter.embedding.engine.FlutterJNI.onSurfaceCreated(FlutterJNI.java:3)
3 io.flutter.embedding.engine.renderer.FlutterRenderer.startRenderingToSurface(FlutterRenderer.java:16)
4 io.flutter.embedding.android.FlutterSurfaceView.connectSurfaceToRenderer(FlutterSurfaceView.java:3)
5 io.flutter.embedding.android.FlutterSurfaceView.b(FlutterSurfaceView.java:1)
6 io.flutter.embedding.android.FlutterSurfaceView$a.surfaceCreated(FlutterSurfaceView.java:4)
7 android.view.SurfaceView.updateSurface(SurfaceView.java:728)
8 android.view.SurfaceView$2.onPreDraw(SurfaceView.java:151)
9 android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
10 android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2573)
11 android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1558)
12 android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7463)
13 android.view.Choreographer$CallbackRecord.run(Choreographer.java:1041)
14 android.view.Choreographer.doCallbacks(Choreographer.java:847)
15 android.view.Choreographer.doFrame(Choreographer.java:774)
16 android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1027)
17 android.os.Handler.handleCallback(Handler.java:809)
18 android.os.Handler.dispatchMessage(Handler.java:102)
19 android.os.Looper.loop(Looper.java:166)
20 android.app.ActivityThread.main(ActivityThread.java:7555)

1.gpu thread: signal SIGSEGV(SEGV_MAPERR)

#00 0x001682a8 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
flutter::Rasterizer::Setup(std::__1::unique_ptr<flutter::Surface, std::__1::default_delete<flutter::Surface> >)
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/shell/common/rasterizer.cc:69:17
#01 0x0016ec67 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
flutter::Shell::OnPlatformViewCreated(std::__1::unique_ptr<flutter::Surface, std::__1::default_delete<flutter::Surface> >)::$_8::operator()()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/shell/common/shell.cc:566:23
auto fml::internal::CopyableLambda<flutter::Shell::OnPlatformViewCreated(std::__1::unique_ptr<flutter::Surface, std::__1::default_delete<flutter::Surface> >)::$_8>::operator()<>() const
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/make_copyable.h:24:0
#02 0x00146755 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
std::__1::function<void ()>::operator()() const
/b/s/w/ir/cache/builder/src/out/android_release/../../third_party/libcxx/include/functional:2419:12
fml::MessageLoopImpl::FlushTasks(fml::FlushType)
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/message_loop_impl.cc:123:0
fml::MessageLoopImpl::RunExpiredTasksNow()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/message_loop_impl.cc:133:0
#03 0x00148489 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
fml::MessageLoopAndroid::OnEventFired()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/platform/android/message_loop_android.cc:92:5
fml::MessageLoopAndroid::MessageLoopAndroid()::$_0::operator()(int, int, void*) const
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/platform/android/message_loop_android.cc:42:0
fml::MessageLoopAndroid::MessageLoopAndroid()::$_0::__invoke(int, int, void*)
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/platform/android/message_loop_android.cc:40:0
#04 0x0000ff09 /system/lib/libutils.so (_ZN7android6Looper9pollInnerEi+580) [armeabi-v8::862798b286f1ba97372696549a8bea80]
#05 0x0000fc2d /system/lib/libutils.so (_ZN7android6Looper8pollOnceEiPiS1_PPv+32) [armeabi-v8::862798b286f1ba97372696549a8bea80]
#06 0x0000c9e1 /system/lib/libandroid.so (ALooper_pollOnce+56) [armeabi-v8::2f44f33bd999188a75f397fa44228d46]
#07 0x00148561 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
fml::MessageLoopAndroid::Run()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/platform/android/message_loop_android.cc:68:18
#08 0x00145adf /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
fml::MessageLoopImpl::DoRun()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/message_loop_impl.cc:92:3
fml::MessageLoop::Run()
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/message_loop.cc:49:0
#09 0x001474a1 /data/app/com.bilibili.comic-UlhrVZRG20zydm5ToI41uw==/lib/arm/libflutter.so [armeabi-v7a::8d3ed6bbd864323d41970181b0b00b84]
fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0::operator()() const
/b/s/w/ir/cache/builder/src/out/android_release/../../flutter/fml/thread.cc:34:10
decltype(std::__1::forward<fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(fp)()) std::__1::__invoke<fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0&&)
/b/s/w/ir/cache/builder/src/out/android_release/../../third_party/libcxx/include/type_traits:3530:0
void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0>&, std::__1::__tuple_indices<>)
/b/s/w/ir/cache/builder/src/out/android_release/../../third_party/libcxx/include/thread:341:0
void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, fml::Thread::Thread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::$_0> >(void*)
/b/s/w/ir/cache/builder/src/out/android_release/../../third_party/libcxx/include/thread:351:0
#10 0x000473eb /system/lib/libc.so (_ZL15__pthread_startPv+22) [armeabi-v8::c38cb0ea3187a942d434b91b139f1edd]
#11 0x0001ad29 /system/lib/libc.so (__start_thread+32) [armeabi-v8::c38cb0ea3187a942d434b91b139f1edd]
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G2022, locale zh-Hans-CN)
    • Flutter version 1.12.13+hotfix.5 at /Users/wangyongrong/Library/flutter
    • Framework revision 27321ebbad (2 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/wangyongrong/Documents/Android-SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/wangyongrong/Documents/Android-SDK
    • Java binary at: /Applications/Android Studio 2.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] VS Code (version 1.41.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.7.1

[✓] Connected device (1 available)
    • VOG AL10 • APH7N19329001298 • android-arm64 • Android 9 (API 28)

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consolec: regressionIt was better in the past than it is nowcustomer: bytedancecustomer: crowdAffects or could affect many people, though not necessarily a specific customer.dependency: skiaSkia team may need to help use: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions