mrcendre / motion

A Flutter plugin to apply a gyroscope-based motion effect to widgets.
GNU General Public License v3.0
39 stars 15 forks source link

Fatal `NSInternalInconsistencyException` when terminating application #13

Closed Maatteogekko closed 1 year ago

Maatteogekko commented 1 year ago

I am getting this error on iOS. So far got 3 reports, all on the iPhone 12 mini

NSInternalInconsistencyException Sending a message before the FlutterEngine has been run.

Stacktrace: 02fd7c2211694d7dad91337afbe2d033-symbolicated.crash.zip

mrcendre commented 1 year ago

Hello, thanks for the report !

Can you please paste the output of flutter doctor -v ?

Also, are you experiencing this crash within the sample app our your own app ?

Maatteogekko commented 1 year ago

I am receiving this as a report of my app in production. I haven't tried to replicate it yet (only a few crashes so far)

flutter doctor -v ``` [✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-IT) • Flutter version 3.3.10 on channel stable at /Users/gekko/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 135454af32 (8 weeks ago), 2022-12-15 07:36:55 -0800 • Engine revision 3316dd8728 • Dart version 2.18.6 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1) • Android SDK at /Users/gekko/Library/Android/sdk • Platform android-33, build-tools 33.0.1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.3) • 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 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.75.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.58.0 [✓] Connected device (3 available) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.1 22C65 darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 109.0.5414.119 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```
seceba commented 1 year ago

Hello, I have the same problem. I received 676 crash reports in 10 days.

I was using it for the background to be animated on the homepage, I think that's why I'm getting a lot of crashes.

crashreport.crash.zip

mrcendre commented 1 year ago

Hello everyone, thanks for reporting this bug. According to the crash stacktrace, it is a race between threads after the FlutterEngine has been detached due to the app being closed. Motion events may still be sent to the engine at that point, causing the Flutter framework to throw this NSInternalInconsistencyException.

This is fixed as of version 1.4.0 by cleaning up all stream handlers when the plugin is detached from the engine and try/catching the event sending logic.

Closing this for now, please update to motion: ^1.4.0 and let me know if the issue persists, in which case we can reopen it.