Firebase CrashLytics Report
CloudFirestorePlugin.java line 106io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a
Describe the bug
I'm facing weird issue that make app crashing in production mode and it's happened once time and don't happened if I try same action I have did , so when try add item in firebase it's crashing and if return try same item in same condition maybe didn't crashed but I have cashed these issues
Flutter doctor
Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.19.0-1.0.pre.22, on Mac OS X 10.15.3 19D76, locale en-EG)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[✓] Android Studio (installed)
[✓] Connected device (1 available)
CloudFirestorePlugin.java line 106
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void j.b.a.a.n.a(java.lang.String, java.lang.Object)' on a null object reference
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a (CloudFirestorePlugin.java:106)
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.a (CloudFirestorePlugin.java:2)
com.google.firebase.firestore.DocumentReference.a (DocumentReference.java:87)
com.google.firebase.firestore.DocumentReference$$Lambda$3.a (DocumentReference.java:6)
com.google.firebase.firestore.core.AsyncEventListener.a (AsyncEventListener.java:6)
com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run (AsyncEventListener.java:6)
android.os.Handler.handleCallback (Handler.java:873)
android.os.Handler.dispatchMessage (Handler.java:99)
com.google.android.gms.internal.tasks.zzb.dispatchMessage (zzb.java)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7156)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
CloudFirestorePlugin.java line 451
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent (CloudFirestorePlugin.java:451)
io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$EventObserver.onEvent (CloudFirestorePlugin.java:433)
com.google.firebase.firestore.Query.lambda$addSnapshotListenerInternal$2 (com.google.firebase:firebase-firestore@@21.3.0:1025)
com.google.firebase.firestore.Query$$Lambda$3.onEvent (Unknown Source:6)
com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0 (com.google.firebase:firebase-firestore@@21.3.0:42)
com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run (Unknown Source:6)
android.os.Handler.handleCallback (Handler.java:873)
android.os.Handler.dispatchMessage (Handler.java:99)
com.google.android.gms.internal.tasks.zzb.dispatchMessage (com.google.android.gms:play-services-tasks@@17.0.2:6)
android.os.Looper.loop (Looper.java:214)
android.app.ActivityThread.main (ActivityThread.java:7156)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
Have the same problem and posted an issue here: https://github.com/FirebaseExtended/flutterfire/issues/2529
It seems to be that if you start a stream, and then exit the app and go back in, when you try to write information for that stream the querysnapshot update handler in the cloud_firestore throws a null error
Have the same problem and posted an issue here: #2529
It seems to be that if you start a stream, and then exit the app and go back in, when you try to write information for that stream the querysnapshot update handler in the cloud_firestore throws a null error
I don't closed the app just while using but it's not related with specific action maybe when delete or add or update it's appear or maybe once from 100 times attempt add
@niypoo ok, might be a result of a similar root issue, just two different ways to get it. It consistently happens for me when i back out on android and restart and then try and add to the database. However, downgrading to 0.13.4+2 has seemed to solve the issue for now. Hopefully this gets fixed in future updates
@niypoo ok, might be a result of a similar root issue, just two different ways to get it. It consistently happens for me when i back out on android and restart and then try and add to the database. However, downgrading to 0.13.4+2 has seemed to solve the issue for now. Hopefully this gets fixed in future updates
it happened with me only in production release , is it with you ?
no, it happens in debug as well
no, it happens in debug as well
maybe it's not my issue but I will downgrade and try
Looks like this is as a result of #2269, cc @lidongze91 & @cyanglaz from the PR.
Looks like channel is now null in certain scenarios when observers are triggering their events here:
Seems like very similar to #2390
@Salakar
Thanks for tagging me on this.
The issue is that when onDetachedFromEngine happens, we invalidates the channel, which makes sense. What we didn't do, was to invalidate all the local vars from the plugins, including the observers.
I think we should probably just clear all of the below when detachedFromEngine. Unless there are some edge case that I'm missing, which requires us to hold any of those objects even after we detached from engine?
private final SparseArray<EventObserver> observers = new SparseArray<>();
private final SparseArray<DocumentObserver> documentObservers = new SparseArray<>();
private final SparseArray<ListenerRegistration> listenerRegistrations = new SparseArray<>();
private final SparseArray<WriteBatch> batches = new SparseArray<>();
private final SparseArray<Transaction> transactions = new SparseArray<>();
private final SparseArray<TaskCompletionSource> completionTasks = new SparseArray<>();
cc @lidongze91
Talked with Chris offline. I agree we should probably clear all of the observers. Just waiting for the green signal to make sure this doesn't catch some other edge cases and I can go ahead with a fix patch.
Any update on this? This is happening with me after upgrading flutter from 1.12.13 to 1.17.1 and updating all the packages to their latest as of 27 May 2020 including cloud_firestore,firebase_auth.
Exception :
D/AndroidRuntime( 876): Shutting down VM
E/AndroidRuntime( 876): FATAL EXCEPTION: main
E/AndroidRuntime( 876): Process: com.<package>.app, PID: 876
E/AndroidRuntime( 876): java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference
E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:429)
E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:402)
E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore@@21.3.0:504)
E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference$$Lambda$3.onEvent(Unknown Source:6)
E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore@@21.3.0:42)
E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run(Unknown Source:6)
E/AndroidRuntime( 876): at android.os.Handler.handleCallback(Handler.java:883)
E/AndroidRuntime( 876): at android.os.Handler.dispatchMessage(Handler.java:100)
E/AndroidRuntime( 876): at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks@@17.0.2:6)
E/AndroidRuntime( 876): at android.os.Looper.loop(Looper.java:214)
E/AndroidRuntime( 876): at android.app.ActivityThread.main(ActivityThread.java:7356)
E/AndroidRuntime( 876): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 876): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/AndroidRuntime( 876): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
I/Process ( 876): Sending signal. PID: 876 SIG: 9
Lost connection to device.
This is my dependency list
firebase_auth: ^0.16.1
cloud_firestore: ^0.13.6
firebase_storage: ^3.1.6
firebase_messaging: ^6.0.16
cloud_functions: ^0.5.0
provider: ^4.1.2
rxdart: ^0.24.1
equatable: ^1.1.1
sqflite: ^1.3.0+2
firebase_crashlytics: ^0.1.3+3
firebase_performance: ^0.3.2
Output of flutter doctor
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18363.836], locale en-IN)
• Flutter version 1.17.1 at C:\dev\flutter
• Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ravik\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.1)
• VS Code at C:\Users\ravik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.2
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!
Any update on this? This is happening with me after upgrading flutter from 1.12.13 to 1.17.1 and updating all the packages to their latest as of 27 May 2020 including cloud_firestore,firebase_auth.
Exception :
D/AndroidRuntime( 876): Shutting down VM E/AndroidRuntime( 876): FATAL EXCEPTION: main E/AndroidRuntime( 876): Process: com.<package>.app, PID: 876 E/AndroidRuntime( 876): java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:429) E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:402) E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore@@21.3.0:504) E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference$$Lambda$3.onEvent(Unknown Source:6) E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore@@21.3.0:42) E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run(Unknown Source:6) E/AndroidRuntime( 876): at android.os.Handler.handleCallback(Handler.java:883) E/AndroidRuntime( 876): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime( 876): at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks@@17.0.2:6) E/AndroidRuntime( 876): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime( 876): at android.app.ActivityThread.main(ActivityThread.java:7356) E/AndroidRuntime( 876): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 876): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime( 876): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) I/Process ( 876): Sending signal. PID: 876 SIG: 9 Lost connection to device.This is my dependency list
firebase_auth: ^0.16.1
cloud_firestore: ^0.13.6
firebase_storage: ^3.1.6
firebase_messaging: ^6.0.16
cloud_functions: ^0.5.0
provider: ^4.1.2
rxdart: ^0.24.1
equatable: ^1.1.1
sqflite: ^1.3.0+2
firebase_crashlytics: ^0.1.3+3
firebase_performance: ^0.3.2Output of flutter doctor
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18363.836], locale en-IN)
• Flutter version 1.17.1 at C:\dev\flutter
• Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ravik\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)[√] VS Code (version 1.45.1)
• VS Code at C:\Users\ravik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.2[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)• No issues found!
it's disappeared after downgrade firestore package to cloud_firestore: 0.13.4+2
Any update on this? This is happening with me after upgrading flutter from 1.12.13 to 1.17.1 and updating all the packages to their latest as of 27 May 2020 including cloud_firestore,firebase_auth.
Exception :
D/AndroidRuntime( 876): Shutting down VM E/AndroidRuntime( 876): FATAL EXCEPTION: main E/AndroidRuntime( 876): Process: com.<package>.app, PID: 876 E/AndroidRuntime( 876): java.lang.NullPointerException: Attempt to invoke virtual method 'void io.flutter.plugin.common.MethodChannel.invokeMethod(java.lang.String, java.lang.Object)' on a null object reference E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:429) E/AndroidRuntime( 876): at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$DocumentObserver.onEvent(CloudFirestorePlugin.java:402) E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference.lambda$addSnapshotListenerInternal$2(com.google.firebase:firebase-firestore@@21.3.0:504) E/AndroidRuntime( 876): at com.google.firebase.firestore.DocumentReference$$Lambda$3.onEvent(Unknown Source:6) E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener.lambda$onEvent$0(com.google.firebase:firebase-firestore@@21.3.0:42) E/AndroidRuntime( 876): at com.google.firebase.firestore.core.AsyncEventListener$$Lambda$1.run(Unknown Source:6) E/AndroidRuntime( 876): at android.os.Handler.handleCallback(Handler.java:883) E/AndroidRuntime( 876): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime( 876): at com.google.android.gms.internal.tasks.zzb.dispatchMessage(com.google.android.gms:play-services-tasks@@17.0.2:6) E/AndroidRuntime( 876): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime( 876): at android.app.ActivityThread.main(ActivityThread.java:7356) E/AndroidRuntime( 876): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 876): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) E/AndroidRuntime( 876): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930) I/Process ( 876): Sending signal. PID: 876 SIG: 9 Lost connection to device.
This is my dependency list
firebase_auth: ^0.16.1
cloud_firestore: ^0.13.6
firebase_storage: ^3.1.6
firebase_messaging: ^6.0.16
cloud_functions: ^0.5.0
provider: ^4.1.2
rxdart: ^0.24.1
equatable: ^1.1.1
sqflite: ^1.3.0+2
firebase_crashlytics: ^0.1.3+3
firebase_performance: ^0.3.2
Output of flutter doctor
[√] Flutter (Channel stable, v1.17.1, on Microsoft Windows [Version 10.0.18363.836], locale en-IN)
• Flutter version 1.17.1 at C:\dev\flutter
• Framework revision f7a6a7906b (2 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ravik\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
• All Android licenses accepted.
[√] Android Studio (version 3.6)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 45.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
[√] VS Code (version 1.45.1)
• VS Code at C:\Users\ravik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.10.2
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• No issues found!it's disappeared after downgrade firestore package to
cloud_firestore: 0.13.4+2
Yes I downgraded below packages and its working fine.
cloud_firestore: ^0.13.4+2
firebase_auth: ^0.15.5+3
Hey all, as part of our on-going work for #2582, this has been resolved in our Firebase Firestore rework (#2913) - which has now been merged into master. We'll look at publishing some prereleases in the next few days. Thank you