quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

[Bug] Firestore crash when using Android emulator

Open Nyankoo opened this issue 3 years ago • 18 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.9f1
  • Firebase Unity SDK version: 7.2.0
  • Source you installed the SDK: Unity Package Manager with tgz
  • Problematic Firebase Component: Firestore
  • Other Firebase Components in use: Auth, Crashlytics, Remote Config
  • Additional SDKs you are using:
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the issue here:

E/AndroidRuntime( 5020): FATAL EXCEPTION: main
E/AndroidRuntime( 5020): Process: com.example.game, PID: 5020
E/AndroidRuntime( 5020): java.lang.Error: FATAL EXCEPTION [main]
E/AndroidRuntime( 5020): Unity version     : 2020.3.9f1
E/AndroidRuntime( 5020): Device model      : samsung SM-G955N
E/AndroidRuntime( 5020): Device fingerprint: samsung/SM-G955N/dream2lteks:5.1.1/NRD90M/500200305:user/release-keys
E/AndroidRuntime( 5020): Build Type        : Release
E/AndroidRuntime( 5020): Scripting Backend : IL2CPP
E/AndroidRuntime( 5020): ABI               : armeabi-v7a
E/AndroidRuntime( 5020): Strip Engine Code : true

E/AndroidRuntime( 5020): Caused by: java.lang.RuntimeException: Internal error in Cloud Firestore (22.1.2).

E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:534)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.util.AsyncQueue$$Lambda$3.run(AsyncQueue.java)
E/AndroidRuntime( 5020): 	at android.os.Handler.handleCallback(Handler.java:739)
E/AndroidRuntime( 5020): 	at android.os.Handler.dispatchMessage(Handler.java:95)
E/AndroidRuntime( 5020): 	at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 5020): 	at android.app.ActivityThread.main(ActivityThread.java:5307)
E/AndroidRuntime( 5020): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 5020): 	at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 5020): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
E/AndroidRuntime( 5020): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
E/AndroidRuntime( 5020): Caused by: java.lang.IllegalArgumentException: Timestamp seconds out of range: 6967862201976803777
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.util.Preconditions.checkArgument(Preconditions.java:117)
E/AndroidRuntime( 5020): 	at com.google.firebase.Timestamp.validateRange(Timestamp.java:159)
E/AndroidRuntime( 5020): 	at com.google.firebase.Timestamp.<init>(Timestamp.java:63)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.RemoteSerializer.decodeTimestamp(RemoteSerializer.java:110)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.RemoteSerializer.decodeVersion(RemoteSerializer.java:121)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.RemoteSerializer.decodeWatchChange(RemoteSerializer.java:873)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:106)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:38)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.lambda$onNext$1(AbstractStream.java:119)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.AbstractStream$StreamObserver$$Lambda$2.run(AbstractStream.java)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.AbstractStream$CloseGuardedRunner.run(AbstractStream.java:67)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.onNext(AbstractStream.java:110)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.remote.FirestoreChannel$1.onMessage(FirestoreChannel.java:125)
E/AndroidRuntime( 5020): 	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:658)
E/AndroidRuntime( 5020): 	at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:643)
E/AndroidRuntime( 5020): 	at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
E/AndroidRuntime( 5020): 	at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
E/AndroidRuntime( 5020): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
E/AndroidRuntime( 5020): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime( 5020): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
E/AndroidRuntime( 5020): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
E/AndroidRuntime( 5020): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 5020): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 5020): 	at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:229)
E/AndroidRuntime( 5020): 	at java.lang.Thread.run(Thread.java:818)
W/ActivityManager( 1779):   Force finishing activity 1 com.example.game/com.google.firebase.MessagingUnityPlayerActivity

Steps to reproduce:

Relevant Code:

Nyankoo avatar Jun 02 '21 18:06 Nyankoo

Hi @Nyankoo,

In order to identify what's causing this behavior, could you share a minimal, reproducible example of your project along with the steps you've taken before facing this issue?

paulinon avatar Jun 03 '21 14:06 paulinon

Furthermore, are you able to share debug logs if this is reproducible? You can change the log level with this API: https://firebase.google.com/docs/reference/unity/namespace/firebase#namespace_firebase_1ae165d1d7bc3d85e1c0463a2a1d9ced9a

If you change the log level to DEBUG then will be able to see the messages that the SDK receives from the backend.

schmidt-sebastian avatar Jun 03 '21 21:06 schmidt-sebastian

@schmidt-sebastian I'm still trying to recreate this in a minimal repro, but in the meantime, you can find the complete logcat with DEBUG enabled here.

62001_logcat.txt

Nyankoo avatar Jun 03 '21 22:06 Nyankoo

Unfortunately, Firestore only logs its network traffic when the log level is explicitly set to debug. Even if you cannot create a minimal repro, a debug log that shows the network traffic would help tremendously.

schmidt-sebastian avatar Jun 04 '21 03:06 schmidt-sebastian

@schmidt-sebastian The log level is set to debug in the above logcat file (with FirebaseApp.LogLevel = LogLevel.Debug)

Nyankoo avatar Jun 04 '21 20:06 Nyankoo

The log level for Firestore is independent from FirebaseApp. You should see some log messages that show the communication from the WatchStream and the WriteStream.

schmidt-sebastian avatar Jun 04 '21 22:06 schmidt-sebastian

@schmidt-sebastian Any guides or pointers how to correctly set this up so I can provide a useful logcat?

Nyankoo avatar Jun 04 '21 22:06 Nyankoo

You can use

FirebaseFirestore.LogLevel = LogLevel.Debug;

var-const avatar Jun 05 '21 00:06 var-const

@var-const Thank you!

@schmidt-sebastian Please find the logcat with WatchStream and WriteStream below. 62001_logcat.txt

Nyankoo avatar Jun 05 '21 08:06 Nyankoo

@Nyankoo This is very helpful and exactly what I need. Thank you.

schmidt-sebastian avatar Jun 07 '21 16:06 schmidt-sebastian

@Nyankoo Are you talking to our production backend or to the Emulator?

schmidt-sebastian avatar Jun 11 '21 19:06 schmidt-sebastian

@schmidt-sebastian What exactly do you mean?

Nyankoo avatar Jun 11 '21 19:06 Nyankoo

Are you using "useEmulator()" in your app and talking to "localhost" instead of "firestore.googleapis.com"?

schmidt-sebastian avatar Jun 11 '21 20:06 schmidt-sebastian

@schmidt-sebastian I'm not using any special emulator-related methods.

Nyankoo avatar Jun 11 '21 20:06 Nyankoo

We also just had the same crash report through Crashlytics on a Reno Ace with Android 5.1.1, but we can't confirm if this is actually an emulator or real device on the user's end.

Nyankoo avatar Jun 12 '21 23:06 Nyankoo

@schmidt-sebastian Any progress with this issue?

Nyankoo avatar Jul 07 '21 18:07 Nyankoo

We believe this is invalid data coming from the backend. We have a bug to track this - b/191139962. There are no updates yet.

schmidt-sebastian avatar Jul 13 '21 20:07 schmidt-sebastian

Hello, has this bug been fixed? We also encountered this problem.

11-14 01:35:05.441 E/AndroidRuntime( 2969): FATAL EXCEPTION: main
11-14 01:35:05.441 E/AndroidRuntime( 2969): Process: , PID: 2969
11-14 01:35:05.441 E/AndroidRuntime( 2969): java.lang.Error: FATAL EXCEPTION [main]
11-14 01:35:05.441 E/AndroidRuntime( 2969): Unity version     : 2020.3.48f1c1
11-14 01:35:05.441 E/AndroidRuntime( 2969): Device model      : Xiaomi MI 5s
11-14 01:35:05.441 E/AndroidRuntime( 2969): Device fingerprint: OnePlus/OnePlus2/OnePlus2:6.0.1/MMB29M/1447841200:user/release-keys
11-14 01:35:05.441 E/AndroidRuntime( 2969): Build Type        : Release
11-14 01:35:05.441 E/AndroidRuntime( 2969): Scripting Backend : IL2CPP
11-14 01:35:05.441 E/AndroidRuntime( 2969): ABI               : x86
11-14 01:35:05.441 E/AndroidRuntime( 2969): Strip Engine Code : true
11-14 01:35:05.441 E/AndroidRuntime( 2969): 
11-14 01:35:05.441 E/AndroidRuntime( 2969): Caused by: java.lang.RuntimeException: Internal error in Cloud Firestore (24.9.1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.util.AsyncQueue.p(AsyncQueue.java:5)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.util.h.run(lambda)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at android.os.Handler.handleCallback(Handler.java:739)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at android.os.Looper.loop(Looper.java:148)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at android.app.ActivityThread.main(ActivityThread.java:5654)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.lang.reflect.Method.invoke(Native Method)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:672)
11-14 01:35:05.441 E/AndroidRuntime( 2969): Caused by: java.lang.IllegalArgumentException: Timestamp seconds out of range: 7301194837235273221
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.util.e0.a(Preconditions.java:1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.Timestamp.validateRange(Timestamp.java:4)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.Timestamp.<init>(Timestamp.java:2)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.o0.w(RemoteSerializer.java:1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.o0.y(RemoteSerializer.java:3)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.o0.A(RemoteSerializer.java:23)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.x0.y(WatchStream.java:2)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.x0.r(WatchStream.java:1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.z$c.i(AbstractStream.java:6)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.z$c.j(AbstractStream.java)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.c.run(lambda)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.z$a.a(AbstractStream.java:3)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.z$c.d(AbstractStream.java:1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.remote.j0$a.c(FirestoreChannel.java:1)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at g.a.s1.z$k.c(DelayedClientCall.java:2)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at g.a.s1.p$d$b.b(ClientCallImpl.java:4)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at g.a.s1.p$d$b.a(ClientCallImpl.java:3)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at g.a.s1.x.run(ContextRunnable.java:2)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at g.a.s1.d2.run(SerializingExecutor.java:3)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:269)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at com.google.firebase.firestore.util.AsyncQueue$c$b.run(AsyncQueue.java:3)
11-14 01:35:05.441 E/AndroidRuntime( 2969): 	at java.lang.Thread.run(Thread.java:818)
11-14 01:35:05.442 W/ActivityManager(  729):   Force finishing activity com.unity3d.player.UnityPlayerActivity

potatoyz avatar Nov 14 '23 07:11 potatoyz