Open domesticmouse opened 1 month ago
Note, this app does not crash under Flutter 3.19.5 / Dart 3.3.3
Hey Brett! I have been investigating emulator stability in general for the engine and I'd be happy to take a look tomorrow.
Reverting the Runners to code generated by Flutter 3.19.5 - https://github.com/domesticmouse/codelabs/commit/447e2bc18be182015878f94c8193b80701da36d1 - is sufficient for this code to not crash under Flutter 3.21.0-1.0.pre.2 on Android Emulator
Hey Brett! I have been investigating emulator stability in general for the engine and I'd be happy to take a look tomorrow.
Let me know what else I can do to help here. Not having my codelabs crash under Flutter 3.21 would be really neat =)
@domesticmouse Chatted with @jonahwilliams, it's not very obvious but this is a Dart VM crash:
F/libc ( 7066): Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x6f0000006e in tid 7241 (DartWorker), pid 7066 (erate_crossword)
DartWorker
is the Dart GC thread. If you're wondering how you have learned this yourself ... it's sort of hard - you can get symbols from a local engine builds or by using the symbolizer bot tool.
Marking P1 and dependency: dart
to have the VM team take a look. Thanks for flagging!
Symbolized stack trace (the engine is using Dart SDK commit c38c85a4
)
third_party/libcxx/include/atomic:1052 [__cxx_atomic_fetch_and]
third_party/dart/runtime/vm/raw_object.cc:566 [VARIABLE_COMPRESSED_VISITOR(Array)]
third_party/dart/runtime/vm/raw_object.h:445 [VisitPointersNonvirtual]
third_party/dart/runtime/vm/heap/marker.cc:905 [ConcurrentMarkTask::Run]
third_party/dart/runtime/vm/thread_pool.cc:158
third_party/dart/runtime/vm/thread_pool.cc:330
Attempted to reproduce this using app commit 95bd5ab0
and Flutter framework commit c398442c
. Did not see the crash on any of the arm64 and x64 emulator configurations that I tried.
I tried running it again to see if it was just a flake, but it repro'd for me.
β step_10 git:(95bd5ab0) flutter run
Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'... 31.2s
β Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk... 1,511ms
Syncing files to device sdk gphone64 arm64... 316ms
Flutter run key commands.
r Hot reload. π₯π₯π₯
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on sdk gphone64 arm64 is available at: http://127.0.0.1:52450/j0oXfgiv4G4=/
The Flutter DevTools debugger and profiler on sdk gphone64 arm64 is available at:
http://127.0.0.1:9103?uri=http://127.0.0.1:52450/j0oXfgiv4G4=/
D/EGL_emulation( 9738): app_time_stats: avg=83.50ms min=4.50ms max=552.73ms count=18
D/EGL_emulation( 9738): app_time_stats: avg=41.85ms min=6.29ms max=341.82ms count=26
D/EGL_emulation( 9738): app_time_stats: avg=26.85ms min=8.15ms max=168.51ms count=42
D/EGL_emulation( 9738): app_time_stats: avg=22.23ms min=2.86ms max=161.91ms count=41
D/EGL_emulation( 9738): app_time_stats: avg=29.80ms min=4.14ms max=166.62ms count=33
D/EGL_emulation( 9738): app_time_stats: avg=19.36ms min=2.00ms max=116.74ms count=42
D/EGL_emulation( 9738): app_time_stats: avg=24.61ms min=7.23ms max=134.08ms count=41
D/EGL_emulation( 9738): app_time_stats: avg=13.19ms min=2.11ms max=77.97ms count=52
D/EGL_emulation( 9738): app_time_stats: avg=14.74ms min=1.57ms max=89.72ms count=52
D/EGL_emulation( 9738): app_time_stats: avg=18.65ms min=2.39ms max=84.79ms count=53
D/EGL_emulation( 9738): app_time_stats: avg=14.80ms min=1.62ms max=81.86ms count=51
D/EGL_emulation( 9738): app_time_stats: avg=21.09ms min=1.90ms max=299.01ms count=51
D/EGL_emulation( 9738): app_time_stats: avg=14.48ms min=1.71ms max=181.21ms count=50
D/EGL_emulation( 9738): app_time_stats: avg=19.40ms min=1.77ms max=196.74ms count=46
D/EGL_emulation( 9738): app_time_stats: avg=15.32ms min=1.72ms max=265.07ms count=50
F/libc ( 9738): Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x6f0000006e in tid 9936 (DartWorker), pid 9738 (erate_crossword)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:14/UE1A.230829.036/11036701:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-03-30 07:30:18.154585994+1100
Process uptime: 20s
Cmdline: com.example.generate_crossword
pid: 9738, tid: 9936, name: DartWorker >>> com.example.generate_crossword <<<
uid: 10191
tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x0000006f0000006e
x0 0000000000000004 x1 0000006f0000006e x2 0000006f09880088 x3 0000006f09a80088
x4 0000000000000000 x5 00000073f2529084 x6 00000000ffffffff x7 000122f10001b04b
x8 0000000000000001 x9 00000000001ffffc x10 00000070c889efcc x11 0000006f0988008c
x12 00000000000000c5 x13 000000007fffffff x14 00000000002cfb28 x15 000004558374aea2
x16 0000000000000001 x17 00000073f247b4e8 x18 00000070bb56e000 x19 0000006f09a80088
x20 0000006f0998551c x21 0000006f00000000 x22 b40000731b78f5b0 x23 0000006f0000006f
x24 0000006f09b00b40 x25 00000070c8b53218 x26 0000000000000000 x27 00000000004c4b40
x28 00000070c8b65000 x29 00000000000003e8
lr 00000070c889f04c sp 00000070cb787a40 pc 00000070c8a6f7b0 pst 0000000080001000
10 total frames
backtrace:
#00 pc 00000000025187b0 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#01 pc 0000000002348048 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#02 pc 00000000022c1b84 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#03 pc 0000000002348660 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#04 pc 0000000002348480 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#05 pc 0000000002322484 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#06 pc 00000000023226d4 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#07 pc 00000000022b4a94 /data/app/~~3-H3Wi-OAqJut5S6TiqQGQ==/com.example.generate_crossword-_-pFqLDAMSPT9fMJLSc2Cg==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa)
#08 pc 00000000000cb6a8 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
#09 pc 000000000006821c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: a87908b48b368e6282bcc9f34bcfc28c)
Lost connection to device.
β step_10 git:(95bd5ab0) adb -s emulator-5554 shell getprop ro.build.version.release
14
β step_10 git:(95bd5ab0) adb -s emulator-5554 shell getprop ro.build.version.sdk
34
Here are the details from the Android Device Manager:
Properties
avd.ini.displayname Pixel 7a API 34
avd.ini.encoding UTF-8
AvdId Pixel_7a_API_34
disk.dataPartition.size 6442450944
fastboot.chosenSnapshotFile
fastboot.forceChosenSnapshotBoot no
fastboot.forceColdBoot no
fastboot.forceFastBoot yes
hw.accelerometer yes
hw.arc false
hw.audioInput yes
hw.battery yes
hw.camera.back virtualscene
hw.camera.front emulated
hw.cpu.ncore 4
hw.device.hash2 MD5:437310fd48ee977d023133a2babae359
hw.device.manufacturer Google
hw.device.name pixel_7a
hw.dPad no
hw.gps yes
hw.gpu.enabled yes
hw.gpu.mode auto
hw.initialOrientation Portrait
hw.keyboard yes
hw.lcd.density 420
hw.lcd.height 2400
hw.lcd.width 1080
hw.mainKeys no
hw.ramSize 2048
hw.sdCard yes
hw.sensors.orientation yes
hw.sensors.proximity yes
hw.trackBall no
image.androidVersion.api 34
image.sysdir.1 system-images/android-34/google_apis_playstore/arm64-v8a/
PlayStore.enabled true
runtime.network.latency none
runtime.network.speed full
showDeviceFrame yes
skin.dynamic yes
tag.display Google Play
tag.id google_apis_playstore
vm.heapSize 256
What else can I do to help repro this issue?
//cc @rmacnak-google
I'm not able to reproduce on either Linux X64 (X64 emulator) or Mac ARM64 (ARM64 emulator).
From the disassembly near the stack and the register values, the GC is trying to deference a pointer that looks like the heap base got copied into the lower 32-bits. This might happen if somewhere there is a 64-bit store into an array slot instead of a 32-bit store, i.e., failure to take compressed pointers into account.
x19 0000006f0f700088 last slot x20 0000006f0f6054fc current slot x21 0000006f00000000 heap base x8 0000000000000001 compressed (clobbered, probably was 6f) x23 0000006f0000006f decompressed x1 0000006f0000006e untagged
Ideally, using rr with a watchpoint on the slot would show what corrupted it, but AFAIK rr does not work with Android.
@domesticmouse, could you bisect to find in which commit of Flutter this crash starts happening? If we're lucky it will include some Dart compiler or runtime change where we can find a bad store.
Honest answer, between Cloud Next and Google I/O, I'm currently in negative time.
@domesticmouse we can't make much progress on our side without a clear reproduction, we will wait till you have some time to help us out with this issue.
I should be able to get some time to work on this after Cloud Next next week. Feel free to ping me after the 15th of April if I haven't responded
Steps to reproduce
Expected results
App runs
Actual results
App crashes
Code sample
Code sample
```dart [Paste your code here] ```Screenshots or Video
Screenshots / Video demonstration
[Upload media here]Logs
Logs
```console $ flutter run Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... 46.7s β Built build/app/outputs/flutter-apk/app-debug.apk. Installing build/app/outputs/flutter-apk/app-debug.apk... 579ms Syncing files to device sdk gphone64 arm64... 105ms Flutter run key commands. r Hot reload. π₯π₯π₯ R Hot restart. h List all available interactive commands. d Detach (terminate "flutter run" but leave application running). c Clear the screen q Quit (terminate the application on the device). A Dart VM Service on sdk gphone64 arm64 is available at: http://127.0.0.1:59275/4UxexJyVuG4=/ The Flutter DevTools debugger and profiler on sdk gphone64 arm64 is available at: http://127.0.0.1:9103?uri=http://127.0.0.1:59275/4UxexJyVuG4=/ D/EGL_emulation( 7066): app_time_stats: avg=96.59ms min=4.30ms max=396.15ms count=14 D/EGL_emulation( 7066): app_time_stats: avg=23.77ms min=1.48ms max=189.01ms count=37 D/EGL_emulation( 7066): app_time_stats: avg=18.33ms min=3.10ms max=121.94ms count=43 D/EGL_emulation( 7066): app_time_stats: avg=22.46ms min=3.85ms max=129.65ms count=41 D/EGL_emulation( 7066): app_time_stats: avg=20.46ms min=10.43ms max=134.03ms count=49 D/EGL_emulation( 7066): app_time_stats: avg=20.39ms min=7.45ms max=96.64ms count=49 D/EGL_emulation( 7066): app_time_stats: avg=14.97ms min=1.70ms max=82.30ms count=53 D/EGL_emulation( 7066): app_time_stats: avg=21.53ms min=9.31ms max=84.79ms count=47 D/EGL_emulation( 7066): app_time_stats: avg=25.79ms min=3.73ms max=223.85ms count=38 D/EGL_emulation( 7066): app_time_stats: avg=18.16ms min=2.18ms max=64.17ms count=53 D/EGL_emulation( 7066): app_time_stats: avg=32.37ms min=8.70ms max=246.06ms count=32 D/EGL_emulation( 7066): app_time_stats: avg=27.61ms min=2.28ms max=357.36ms count=42 F/libc ( 7066): Fatal signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x6f0000006e in tid 7241 (DartWorker), pid 7066 (erate_crossword) *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'google/sdk_gphone64_arm64/emu64a:14/UE1A.230829.036/11036701:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: 2024-03-29 12:02:31.195941287+1100 Process uptime: 17s Cmdline: com.example.generate_crossword pid: 7066, tid: 7241, name: DartWorker >>> com.example.generate_crossword <<< uid: 10191 tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE) pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY) signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x0000006f0000006e x0 0000000000000004 x1 0000006f0000006e x2 0000006f0f500088 x3 0000006f0f700088 x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 000068dc000068cc x8 0000000000000001 x9 00000000001ffffc x10 00000070ca6e3fcc x11 0000006f0f50008c x12 00000000000000c5 x13 000000007fffffff x14 000000000023242c x15 000004494e07ba07 x16 0000000000000001 x17 00000073f24f6a5c x18 00000070aec70000 x19 0000006f0f700088 x20 0000006f0f6054fc x21 0000006f00000000 x22 b40000731b791990 x23 0000006f0000006f x24 0000006f05df8848 x25 00000070ca998218 x26 0000000000000000 x27 000000000000000c x28 00000070ca9aa000 x29 00000000000003e8 lr 00000070ca6e404c sp 00000070b69fba40 pc 00000070ca8b47b0 pst 0000000080001000 10 total frames backtrace: #00 pc 00000000025187b0 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #01 pc 0000000002348048 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #02 pc 00000000022c1b84 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #03 pc 0000000002348660 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #04 pc 0000000002348480 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #05 pc 0000000002322484 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #06 pc 00000000023226d4 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #07 pc 00000000022b4a94 /data/app/~~EzR3UCtKX_5fm1CKJjGRyg==/com.example.generate_crossword-5o37lnN1k7hdiPXGSoaYxw==/lib/arm64/libflutter.so (BuildId: b6be8ecbe9eeb0f8945f39ad3dfc95a77355adaa) #08 pc 00000000000cb6a8 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: a87908b48b368e6282bcc9f34bcfc28c) #09 pc 000000000006821c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: a87908b48b368e6282bcc9f34bcfc28c) Lost connection to device. ```Flutter Doctor output
Doctor output
```console $ flutter doctor -v [β] Flutter (Channel beta, 3.21.0-1.0.pre.2, on macOS 14.4.1 23E224 darwin-arm64, locale en) β’ Flutter version 3.21.0-1.0.pre.2 on channel beta at /Users/brettmorgan/flutter β’ Upstream repository https://github.com/flutter/flutter β’ Framework revision c398442c35 (2 weeks ago), 2024-03-12 22:26:24 -0700 β’ Engine revision 0d4f78c952 β’ Dart version 3.4.0 (build 3.4.0-190.1.beta) β’ DevTools version 2.33.1 [β] Android toolchain - develop for Android devices (Android SDK version 34.0.0) β’ Android SDK at /Users/brettmorgan/Library/Android/sdk β’ Platform android-34, build-tools 34.0.0 β’ 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.3) β’ Xcode at /Applications/Xcode.app/Contents/Developer β’ Build 15E204a β’ CocoaPods version 1.15.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 Community Edition (version 2023.3.2) β’ IntelliJ at /Applications/IntelliJ IDEA CE.app β’ Flutter plugin version 77.0.1 β’ Dart plugin version 233.13135.65 [β] VS Code (version 1.87.2) β’ VS Code at /Applications/Visual Studio Code.app/Contents β’ Flutter extension version 3.84.0 [β] Connected device (4 available) β’ sdk gphone64 arm64 (mobile) β’ emulator-5554 β’ android-arm64 β’ Android 14 (API 34) (emulator) β’ macOS (desktop) β’ macos β’ darwin-arm64 β’ macOS 14.4.1 23E224 darwin-arm64 β’ Mac Designed for iPad (desktop) β’ mac-designed-for-ipad β’ darwin β’ macOS 14.4.1 23E224 darwin-arm64 β’ Chrome (web) β’ chrome β’ web-javascript β’ Google Chrome 123.0.6312.87 [β] Network resources β’ All expected network resources are available. β’ No issues found! ```