Skip to content

Crash on AMD cpu when using hardware emulation. Debugging works on the first try but crashes after subsequent tries. #23810

Closed

Description

@PhilParisot

This issue is not related to #23404

I am currently using the flutter master channel and Android Studio on Windows 10 (freshly formatted) using a Ryzen x1700 cpu with Windows Hypervisor Platform (WHPX) and BIOS virtualization turned on. This issue does not happen on my i7 laptop nor can I reproduce it on any of my colleagues' desktops (all using intel cpus).

First launch of the very basic default template app works fine (hot reload and all). Second and all subsequent launches of the app will fail until I wipe all the data on the emulator. Rinse and repeat. This seems to happen only when paired with AMD cpus.

Any help appreciated thank you!

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...
Built build\app\outputs\apk\debug\app-debug.apk.
I/OpenGLRenderer( 6227): Davey! duration=2545ms; Flags=1, IntendedVsync=379624257319, Vsync=381990923891, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=381991615000, AnimationStart=381991776300, PerformTraversalsStart=381992980200, DrawStart=382014511100, SyncQueued=382017731400, SyncStart=382020779100, IssueDrawCommandsStart=382022352600, SwapBuffers=382109363700, FrameCompleted=382172799900, DequeueBufferDuration=48530000, QueueBufferDuration=2135000, 
Syncing files to device Android SDK built for x86...
D/        ( 6227): HostConnection::get() New Host Connection established 0xc4fe1100, tid 6247
D/EGL_emulation( 6227): eglMakeCurrent: 0xdf4bf180: ver 3 0 (tinfo 0xe14836d0)
D/skia    ( 6227): Program linking failed.
E/emuglGLESv2_enc( 6227): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glLinkProgram:1525 GL error 0x501
E/emuglGLESv2_enc( 6227): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetProgramBinary:4058 GL error 0x502
F/libc    ( 6227): /buildbot/src/android/ndk-release-r17/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type std::bad_alloc: std::bad_alloc" failed
F/libc    ( 6227): Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 6247 (1.gpu), pid 6227 (mple.flutterapp)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone_x86/generic_x86:9/PSR1.180720.012/4923214:user/release-keys'
Revision: '0'
ABI: 'x86'
pid: 6227, tid: 6247, name: 1.gpu  >>> com.example.flutterapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Abort message: '/buildbot/src/android/ndk-release-r17/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type std::bad_alloc: std::bad_alloc" failed'
    eax 00000000  ebx 00001853  ecx 00001867  edx 00000006
    edi 00001853  esi 00000000
    ebp cdcaa034  esp cdca9fc8  eip ebda0b59
backtrace:
    #00 pc 00000b59  [vdso:ebda0000] (__kernel_vsyscall+9)
    #01 pc 0001fdf8  /system/lib/libc.so (syscall+40)
    #02 pc 00022ed3  /system/lib/libc.so (abort+115)
    #03 pc 00023388  /system/lib/libc.so (__assert2+56)
    #04 pc 0062df04  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #05 pc 0062e377  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #06 pc 0062e179  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #07 pc 0062d7be  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #08 pc 0062d713  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #09 pc 00630c48  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #10 pc 00630c80  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #11 pc 007e1373  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #12 pc 007dd0d8  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #13 pc 007de37b  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #14 pc 00768286  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #15 pc 0076a522  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #16 pc 0079d4bb  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #17 pc 0077707f  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #18 pc 00776f52  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #19 pc 00763e8f  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #20 pc 007644f4  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #21 pc 007f1591  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #22 pc 007f14a1  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #23 pc 006bcf65  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #24 pc 009e44c0  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #25 pc 00697fe1  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #26 pc 0069e968  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #27 pc 0069edca  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #28 pc 0069f088  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #29 pc 0069ec79  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #30 pc 0069efba  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #31 pc 006696b5  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #32 pc 00669600  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #33 pc 0066b740  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #34 pc 00012a77  /system/lib/libutils.so (android::SimpleLooperCallback::handleEvent(int, int, void*)+39)
    #35 pc 00013896  /system/lib/libutils.so (android::Looper::pollInner(int)+998)
    #36 pc 0001340b  /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+43)
    #37 pc 0000e220  /system/lib/libandroid.so (ALooper_pollOnce+96)
    #38 pc 0066b843  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #39 pc 00667e26  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #40 pc 00669f1b  /data/app/com.example.flutterapp-J_xD2HnVFp_66glZ7bTsKA==/lib/x86/libflutter.so (offset 0x5c6000)
    #41 pc 0008f065  /system/lib/libc.so (__pthread_start(void*)+53)
    #42 pc 0002485b  /system/lib/libc.so (__start_thread+75)
Lost connection to device.


Microsoft Windows [Version 10.0.17134.376]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\ppari\AndroidStudioProjects\flutter_app>flutter doctor -v
[√] Flutter (Channel master, v0.10.2-pre.130, on Microsoft Windows [Version 10.0.17134.376], locale en-CA)
    • Flutter version 0.10.2-pre.130 at C:\src\flutter
    • Framework revision 070df5b6b2 (2 hours ago), 2018-10-31 21:45:04 -0400
    • Engine revision c79faed71c
    • Dart version 2.1.0 (build 2.1.0-dev.8.0 bf26f760b1)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\ppari\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 29.1.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

• No issues found!

C:\Users\ppari\AndroidStudioProjects\flutter_app>


Activity

  1. changed the title [-]Issue that only happens on AMD cpu. Debugging on the emulator crashes after first try.[/-] [+]Issue that only happens on AMD cpu. Debugging on the emulator crashes after first try. Can't even run first Flutter app.[/+] on Nov 1, 2018
  2. changed the title [-]Issue that only happens on AMD cpu. Debugging on the emulator crashes after first try. Can't even run first Flutter app.[/-] [+]Crash that only happens on AMD cpu. Debugging on the emulator crashes after first try. Can't even run first Flutter app.[/+] on Nov 1, 2018
  3. added
    c: crash
    dependency: dart
    on Nov 1, 2018
  4. added this to the milestone on Nov 1, 2018
  5. PhilParisot commented on Nov 2, 2018

    @PhilParisot
    Author

    Update:
    Things seem to have changed a bit with the last master channel update and the crash still only happens on a second try after a successful first launch on a data wiped emulator:

    Launching lib\main.dart on Android SDK built for x86 in debug mode...
    Initializing gradle...
    Resolving dependencies...
    Gradle task 'assembleDebug'...
    Built build\app\outputs\apk\debug\app-debug.apk.
    Syncing files to device Android SDK built for x86...
    D/        ( 4958): HostConnection::get() New Host Connection established 0xdd046bc0, tid 4984
    D/EGL_emulation( 4958): eglMakeCurrent: 0xdc2efc20: ver 3 0 (tinfo 0xdd045af0)
    D/skia    ( 4958): Program linking failed.
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glLinkProgram:1525 GL error 0x501
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetProgramBinary:4058 GL error 0x502
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:1771 GL error 0x501
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glUseProgram:1771 GL error 0x501
    D/skia    ( 4958): Program linking failed.
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glLinkProgram:1525 GL error 0x501
    E/emuglGLESv2_enc( 4958): device/generic/goldfish-opengl/system/GLESv2_enc/GL2Encoder.cpp:s_glGetProgramBinary:4058 GL error 0x502
    Lost connection to device.
    
    flutter upgrade
    Upgrading Flutter from C:\src\flutter...
    Already up to date.
    
    Upgrading engine...
    Already up-to-date.
    
    Flutter 0.10.3-pre.72 • channel master • https://github.com/flutter/flutter.git
    Framework • revision 949cfcf172 (6 hours ago) • 2018-11-01 12:48:24 -0700
    Engine • revision e91e4db7e0
    Tools • Dart 2.1.0 (build 2.1.0-dev.8.0 bf26f760b1)
    
    Running "flutter packages upgrade" in flutter_app...         5.0s
    
    Running flutter doctor...
    Doctor summary (to see all details, run flutter doctor -v):
    [√] Flutter (Channel master, v0.10.3-pre.72, on Microsoft Windows [Version 10.0.17134.376], locale en-CA)
    [√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    [√] Android Studio (version 3.2)
    [√] Connected device (1 available)
    
    • No issues found!
    
  6. PhilParisot commented on Nov 2, 2018

    @PhilParisot
    Author

    I also get this in the event log:

    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glAttachShader:294 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glAttachShader:294 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetProgramiv:2256 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:2580 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetProgramiv:2256 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glAttachShader:294 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glAttachShader:294 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glBindAttribLocation:323 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetProgramiv:2256 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetUniformLocation:2580 error 0x501
    
    22:42	Emulator: android/android-emugl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp:glGetProgramiv:2256 error 0x501
    
    
  7. PhilParisot commented on Nov 2, 2018

    @PhilParisot
    Author

    Update:

    I didn't try before, but software emulation works fine. I only get the crash when specifying hardware emulation (or when leaving Graphics on Automatic) when editing my Android Virtual Devices (AVD). I have a GTX1080 graphics card paid with a Ryzen x1700. WHPX and SVM turned on. Using the latest graphics drivers and BIOS.

  8. added
    dependency: skia
    engine
    on Nov 2, 2018
  9. PhilParisot commented on Nov 16, 2018

    @PhilParisot
    Author

    Update:

    Hardware emulation works fine with native android apps. Only Flutter apps on AMD cpus crash when using hardware emulation (software emulation and and debugging on a phone still works fine).

  10. changed the title [-]Crash that only happens on AMD cpu. Debugging on the emulator crashes after first try. Can't even run first Flutter app.[/-] [+]Crash on AMD cpu when using hardware emulation. Debugging works on the first try but crashes after subsequent tries.[/+] on Nov 16, 2018
  11. PhilParisot commented on Nov 30, 2018

    @PhilParisot
    Author

    Issue seems to have been fixed with updates. Thank you @zoechi for helping out! Hardware emulation now works on AMD CPUs.

  12. github-actions commented on Aug 14, 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.

  13. locked as resolved and limited conversation to collaborators on Aug 14, 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: crashdependency: dartdependency: skiaengine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions