Skip to content

Crash in gfx::NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL during startup #123

Description

@FlutterIssues

Issue by eseidelGoogle
Friday Aug 07, 2015 at 21:23 GMT
Originally opened as https://github.com/flutter/engine/issues/507


gpu_thread crash during startup.

I started fitness app via shelldb:
sky/tools/shelldb start out/android_Debug sky/packages/sky/example/fitness/lib/main.dart

And right as I was doing so, I hit the recent activity button on my Nexus 5 and attempted to close the Asteroids.apk which was running behind it. I think that caused it to lose its gl context at a bad time.

Not sure if this is repeatable or if we care, but here is a stack:

@chinmaygarde @abarth

signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 27952 (gpu_thread)

pid: 27932, tid: 27952, name: gpu_thread  >>> org.domokit.sky.shell <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
     r0 00000001  r1 00000004  r2 00000001  r3 b6b82d99
     r4 00000004  r5 00000001  r6 b498b608  r7 aebff738
     r8 b498b608  r9 aec26348  sl aebff848  fp b4894c68
     ip b6deed84  sp aebff648  lr b6de6fb4  pc b6de6fb4

Stack Trace:
  RELADDR   FUNCTION                                                                                                          FILE:LINE
  00003fb4  android_atomic_add+16                                                                                             /system/lib/libcutils.so
  0000eb99  android::RefBase::incStrong(void const*) const+6                                                                  /system/lib/libutils.so
  00008e7d  ANativeWindow_acquire+4                                                                                           /system/lib/libandroid.so
  0026e4d9  gfx::NativeViewGLSurfaceEGL::NativeViewGLSurfaceEGL(ANativeWindow*, gfx::SurfaceConfiguration)                    /src/sky_engine/src/out/android_Debug/../../ui/gl/gl_surface_egl.cc:368
  0026df71  gfx::GLSurface::CreateViewGLSurface(ANativeWindow*, gfx::SurfaceConfiguration const&)                             /src/sky_engine/src/out/android_Debug/../../ui/gl/gl_surface_android.cc:52 (discriminator 1)
  002718b7  sky::shell::Rasterizer::OnAcceleratedWidgetAvailable(ANativeWindow*)                                              /src/sky_engine/src/out/android_Debug/../../sky/shell/gpu/rasterizer.cc:41 (discriminator 1)
  v------>  base::Callback<void ()>::Run() const                                                                              /src/sky_engine/src/out/android_Debug/../../base/callback.h:396 (discriminator 1)
  002770c7  base::debug::TaskAnnotator::RunTask(char const*, base::PendingTask const&)                                        /src/sky_engine/src/out/android_Debug/../../base/debug/task_annotator.cc:49 (discriminator 1)
  000a0083  base::MessageLoop::RunTask(base::PendingTask const&)                                                              /src/sky_engine/src/out/android_Debug/../../base/message_loop/message_loop.cc:481
  000a04ef  base::MessageLoop::DeferOrRunPendingTask(base::PendingTask const&)                                                /src/sky_engine/src/out/android_Debug/../../base/message_loop/message_loop.cc:490
  000a05cf  base::MessageLoop::DoWork()                                                                                       /src/sky_engine/src/out/android_Debug/../../base/message_loop/message_loop.cc:602
  000b4c19  mojo::common::MessagePumpMojo::DoRunLoop(mojo::common::MessagePumpMojo::RunState*, base::MessagePump::Delegate*)  /src/sky_engine/src/out/android_Debug/../../mojo/common/message_pump_mojo.cc:159
  000b4cfb  mojo::common::MessagePumpMojo::Run(base::MessagePump::Delegate*)                                                  /src/sky_engine/src/out/android_Debug/../../mojo/common/message_pump_mojo.cc:123
  000a13f1  base::MessageLoop::RunHandler()                                                                                   /src/sky_engine/src/out/android_Debug/../../base/message_loop/message_loop.cc:445 (discriminator 1)
  000a48fd  base::RunLoop::Run()                                                                                              /src/sky_engine/src/out/android_Debug/../../base/run_loop.cc:55
  0009fe0f  base::MessageLoop::Run()                                                                                          /src/sky_engine/src/out/android_Debug/../../base/message_loop/message_loop.cc:288
  000abc85  base::Thread::ThreadMain()                                                                                        /src/sky_engine/src/out/android_Debug/../../base/threading/thread.cc:248
  000ab06f  ThreadFunc                                                                                                        /src/sky_engine/src/out/android_Debug/../../base/threading/platform_thread_posix.cc:74
  00016baf  __pthread_start(void*)+30                                                                                         /system/lib/libc.so
  00014af3  __start_thread+6                                                                                                  /system/lib/libc.so

Activity

  1. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by eseidelGoogle
    Friday Aug 07, 2015 at 21:24 GMT


    Ok, yeah easily repeatable by spamming the "recent activities" button during startup.

  2. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by jamesr
    Monday Aug 10, 2015 at 19:23 GMT


    Maybe the ANativeWindow* died in between posting the On..Available task and it running?

  3. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by chinmaygarde
    Tuesday Aug 11, 2015 at 19:28 GMT


    @eseidelGoogle https://github.com/domokit/sky_engine/blob/master/sky/shell/android/platform_view_android.cc#L63 is passing the Rasterizer an unretained reference. If the last reference is released via PlatformViewAndroid::ReleaseWindow before the the GPU thread is able to create the GLSurface from the same, you would get a crash. I suggest passing the widget as a weak reference and check for the validity of the same when the rasterizer gets the onAcceleratedWidgetAvailable.

  4. FlutterIssues commented on Nov 9, 2015

    @FlutterIssues
    Author

    Comment by jamesr
    Tuesday Aug 11, 2015 at 19:53 GMT


    I'm not seeing anything related to Rasterizer at that line. Weak refs don't work cross thread, which I believe this is trying to do, so we probably need a mutex guarded pointer that we check itself.

  5. modified the milestone: on Dec 16, 2015
  6. added
    engineflutter/engine related. See also e: labels.
    on Dec 16, 2015
  7. eseidelGoogle commented on May 13, 2016

    @eseidelGoogle
    Contributor

    I was able to repro a crash by spamming the recent activities button during launch of a JIT (--debug) built app on Android just now:
    I/DEBUG ( 186): Abort message: '[FATAL:rasterizer_direct.cc(59)] Check failed: surface_. GLSurface required.

    @jason-simmons or @chinmaygarde would know.

    The --release (aot) builds launch too fast to hit this.

  8. eseidelGoogle commented on Jul 13, 2016

    @eseidelGoogle
    Contributor

    I suspect this is long since fixed.

  9. chinmaygarde commented on Jul 13, 2016

    @chinmaygarde
    Contributor

    I got rid of gfx entirely.
    On Wed, Jul 13, 2016 at 8:29 AM Eric Seidel [email protected]
    wrote:

    I suspect this is long since fixed.

    —
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub
    #123 (comment),
    or mute the thread
    https://github.com/notifications/unsubscribe/AACsNbnXDU82xL8XshKRN-b75o2J9pS-ks5qVQRugaJpZM4Ge7vx
    .

  10. github-actions commented on Aug 17, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: crashStack traces logged to the consoleengineflutter/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