Repository navigation
FlutterActivity hangs on VsyncWaiter#nativeOnVsync #19159
Copy link
Copy link
Closed
Labels
c: crashStack traces logged to the consoleStack traces logged to the consoledependency: dartDart team may need to help usDart team may need to help usengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Milestone
Description
Steps to Reproduce
- create a flutter project with default template
- add a timer to call
_incrementCounterrepeatly - restart the activity repeatly
- after 10-20 loops, app will hang on
nativeOnVsyncand produce an ANR
both 0.3.1, 0.5.1, and master channel can reproduce this.
full project code: https://github.com/mimers/flutter-loop-runner
Logs
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x76370a40 self=0x7f93a95a00
| sysTid=14258 nice=-10 cgrp=default sched=0/0 handle=0x7f97a31a98
| state=S schedstat=( 1597601152 46352859 4136 ) utm=122 stm=37 core=4 HZ=100
| stack=0x7fd1766000-0x7fd1768000 stackSize=8MB
| held mutexes=
kernel: (couldn't read /proc/self/task/14258/stack)
native: #00 pc 000000000001c16c /system/lib64/libc.so (syscall+28)
native: #01 pc 00000000000690a0 /system/lib64/libc.so (_ZL33__pthread_mutex_lock_with_timeoutP24pthread_mutex_internal_tbPK8timespec+744)
native: #02 pc 00000000006b3a58 /data/app/com.example.flutterlooprunner-2/lib/arm64/libflutter.so (???)
native: #03 pc 0000000000114450 /data/app/com.example.flutterlooprunner-2/lib/arm64/libflutter.so (???)
native: #04 pc 00000000000c93b0 /data/app/com.example.flutterlooprunner-2/lib/arm64/libflutter.so (???)
native: #05 pc 00000000000047d4 /data/app/com.example.flutterlooprunner-2/oat/arm64/base.odex (Java_io_flutter_view_VsyncWaiter_nativeOnVsync__JJJ+144)
at io.flutter.view.VsyncWaiter.nativeOnVsync(Native method)
at io.flutter.view.VsyncWaiter.access$000(VsyncWaiter.java:9)
at io.flutter.view.VsyncWaiter$1.doFrame(VsyncWaiter.java:17)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:881)
at android.view.Choreographer.doCallbacks(Choreographer.java:689)
at android.view.Choreographer.doFrame(Choreographer.java:621)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:869)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:159)
at android.app.ActivityThread.main(ActivityThread.java:6364)
at java.lang.reflect.Method.invoke!(Native method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1096)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:883)
symbolized result :
~/Library/Android/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-addr2line -e 6fe748490d1772d72274bf8b9efb72c5c2160237/arm64-v8a/libflutter.so 00000000006b3a58 0000000000114450 00000000000c93b0
/usr/local/google/buildbot/src/android/ndk-r12-release/ndk/sources/cxx-stl/llvm-libc++/libcxx/src/mutex.cpp:31 (discriminator 1)
/b/build/slave/Linux_Engine/build/src/out/android_release_arm64/../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/__mutex_base:85
/b/build/slave/Linux_Engine/build/src/out/android_release_arm64/../../third_party/android_tools/ndk/sources/cxx-stl/llvm-libc++/libcxx/include/functional:1756
Analyzing flutter_loop_runner...
No issues found! (ran in 1.3s)
[✓] Flutter (Channel master, v0.5.7-pre.62, on Mac OS X 10.13.5 17F77, locale zh-Hans-CN)
• Flutter version 0.5.7-pre.62 at /Users/joker/codes/flutter
• Framework revision 7ac183794b (2 days ago), 2018-07-06 15:21:29 -0700
• Engine revision 6fe748490d
• Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/joker/Library/Android/sdk
• Android NDK at /Users/joker/Library/Android/sdk/ndk-bundle
• Platform android-27, build-tools 27.0.3
• ANDROID_HOME = /Users/joker/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.2
[✓] Android Studio
• Android Studio at /Applications/Android Studio 3.2 Preview.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b02)
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[!] VS Code (version 1.24.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected devices (1 available)
• OD103 • 3576b9c7 • android-arm64 • Android 7.1.1 (API 25)
! Doctor found issues in 1 category.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: crashStack traces logged to the consoleStack traces logged to the consoledependency: dartDart team may need to help usDart team may need to help usengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Activity
xster commentedon Jul 13, 2018
Thanks for the reduced test case. I ran your example via
adb shell am start -n com.example.flutterlooprunner/.RunnerActivityI couldn't reproduce a crash. cc @jason-simmons in case you can make anything out of the crash stack
Though there's definitely an issue here since previous activities' Timers are still running. #19358 to discuss.
In the meantime, adding a WidgetsBindingObserver via WidgetsBinding.instance.addObserver and stopping the timer seems to let RunnerActivity run ok for long periods of time.
See also doc for https://docs.flutter.io/flutter/dart-ui/AppLifecycleState-class.html
Handle Android vsync callbacks that occur after the VsyncWaiter has b…
Handle Android vsync callbacks that occur after the VsyncWaiter has b…
Handle Android vsync callbacks that occur after the VsyncWaiter has b…
xster commentedon Jul 17, 2018
Re-opening to track flutter-team-archive/engine#5749 making it into the framework.
liyuqian commentedon Jul 17, 2018
Accidentally closed this.
xster commentedon Jul 23, 2018
Seems like this has been rolled into the framework now.
Handle Android vsync callbacks that occur after the VsyncWaiter has b…
github-actions commentedon Sep 2, 2021
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 -vand a minimal reproduction of the issue.Handle Android vsync callbacks that occur after the VsyncWaiter has b…