Skip to content

Android build crashes on getting DocumentChange.Type #889

Closed
@Jack37

Description

@Jack37

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.16f1
  • Firebase Unity SDK version: 7.0.1
  • Source you installed the SDK: Unity Package Manager
  • Problematic Firebase Component: Firestore
  • Other Firebase Components in use: Functions, Cloud Messaging
  • Additional SDKs you are using: IronSource, PlayFab, Photon, Facebook
  • Platform you are using the Unity editor on: Mac
  • Platform you are targeting: Android
  • Scripting Runtime: Mono, IL2CPP

[REQUIRED] Please describe the issue here:

Android build crashes when trying to read ChangeType from QuerySnapshot document changes.

  1. Register a listener for Firestore collection:
FirebaseFirestore db = FirebaseFirestore.DefaultInstance;
db.Collection("matches").WhereEqualTo("player_id", Login.Self.PlayerID).Listen(LoadMatch);
  1. Iterate over the results and try to read document change:
private void LoadMatch(QuerySnapshot snapshot)
{
    foreach (DocumentChange change in snapshot.GetChanges())
    {
        Debug.Log(change.ChangeType); // crashes here
    }
}

Phone crash log:

--------- beginning of crash
2020-12-09 19:42:07.756 16360-16428/? E/AndroidRuntime: FATAL EXCEPTION: UnityMain
    Process: sk.inlogic.chessstrategyboardgame, PID: 16360
    java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    Version '2019.4.16f1 (e05b6e02d63e)', Build type 'Release', Scripting Backend 'mono', CPU 'armeabi-v7a'
    Build fingerprint: 'Sony/H4113/H4113:9/50.2.A.3.77/2122144346:user/release-keys'
    Revision: '0'
    ABI: 'arm'
    Timestamp: 2020-12-09 19:42:06+0100
    pid: 16360, tid: 16428, name: UnityMain  >>> sk.inlogic.chessstrategyboardgame <<<
    uid: 10345
    signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
        r0  00000000  r1  0000402c  r2  00000006  r3  00000008
        r4  00003fe8  r5  0000402c  r6  c524dcf4  r7  0000010c
        r8  0000000b  r9  00000000  r10 e58e928e  r11 c524dd68
        ip  e92cf3cc  sp  c524dce0  lr  e923a115  pc  e9230fde
    
    backtrace:
          #00 pc 0001cfde  /system/lib/libc.so (abort+58) (BuildId: 09d6997dde9d629deac5acecc91661ea)
          #01 pc 0034e351  /system/lib/libart.so (art::Runtime::Abort(char const*)+1664) (BuildId: fb1afbd3fdff41a542b7e911dc4597c1)
          #02 pc 0000738f  /system/lib/libbase.so (android::base::LogMessage::~LogMessage()+494) (BuildId: 414414495a0b4b17c57c98a57c1d3786)
          #03 pc 002324cf  /system/lib/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+1214) (BuildId: fb1afbd3fdff41a542b7e911dc4597c1)
          #04 pc 0026a599  /system/lib/libart.so (art::JNI::CallObjectMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)+1020) (BuildId: fb1afbd3fdff41a542b7e911dc4597c1)
          #05 pc 0015482d  /data/app/sk.inlogic.chessstrategyboardgame-POoH5lCOcJtTGLOLxpYLYA==/lib/arm/libFirebaseCppApp-7_0_1.so (_JNIEnv::CallObjectMethod(_jobject*, _jmethodID*, ...)+16) (BuildId: 634d4e75feefbd66e47541a864ff04b9)
          #06 pc 001835df  /data/app/sk.inlogic.chessstrategyboardgame-POoH5lCOcJtTGLOLxpYLYA==/lib/arm/libFirebaseCppApp-7_0_1.so (std::__ndk1::enable_if<!(is_same<firebase::firestore::DocumentChangeTypeInternal, void>::value), firebase::firestore::jni::ResultTypeMap<firebase::firestore::DocumentChangeTypeInternal, IsPrimitive<firebase::firestore::jni::JniTypeMap<std::__ndk1::decay<firebase::firestore::DocumentChangeTypeInternal>::type>::type>::value>::type>::type firebase::firestore::jni::Env::CallHelper<firebase::firestore::DocumentChangeTypeInternal, _jobject* (_JNIEnv::*&)(_jobject*, _jmethodID*, ...), _jobject*, _jmethodID*>(_jobject* (_JNIEnv::*&&&)(_jobject*, _jmethodID*, ...), _jobject*&&, _jmethodID*&&)+62) (BuildId: 634d4e75feefbd66e47541a864ff04b9)
          #07 pc 0018348f  /data/app/sk.inlogic.chessstrategyboardgame-POoH5lCOcJtTGLOLxpYLYA==/lib/arm/libFirebaseCppApp-7_0_1.so (firebase::firestore::jni::ResultTypeMap<firebase::firestore::DocumentChangeTypeInternal, IsPrimitive<firebase::firestore::jni::JniTypeMap<std::__ndk1::decay<firebase::firestore::DocumentChangeTypeInternal>::type>::type>::value>::type firebase::firestore::jni::Env::Call<firebase::firestore::DocumentChangeTypeInternal>(firebase::firestore::jni::Object const&, firebase::firestore::jni::Method<firebase::firestore::DocumentChangeTypeInternal> const&)+46) (BuildId: 634d4e75feefbd66e47541a864ff04b9)
          #08 pc 0018343b  /data/app/sk.inlogic.chessstrategyboardgame-POoH5lCOcJtTGLOLxpYLYA==/lib/arm/libFirebaseCppApp-7_0_1.so (firebase::firestore::DocumentChangeInternal::type() const+30) (BuildId: 634d4e75feefbd66e47541a864ff04b9)
          #09 pc 0000a516  <anonymous:c41a7000>
    
    managed backtrace:
          #00 (wrapper managed-to-native) Firebase.Firestore.FirestoreCppPINVOKE:DocumentChangeProxy_type (System.Runtime.InteropServices.HandleRef)
          #01 Firebase.Firestore.DocumentChangeProxy:type () <0x2b>
          #02 Firebase.Firestore.DocumentChange:get_ChangeType () <0x23>
          #03 CorrespondenceMode:LoadMatch (Firebase.Firestore.QuerySnapshot) <0x7b>
          #04 Firebase.Firestore.Query/<Listen>c__AnonStorey0/<Listen>c__AnonStorey1:<>m__0 () <0x63>
          #05 Firebase.Dispatcher:Run<TResult_REF> (System.Func`1<TResult_REF>) <0x63>
2020-12-09 19:42:07.758 16360-16428/? E/AndroidRuntime:       #06 Firebase.Platform.FirebaseHandler:RunOnMainThread<TResult_REF> (System.Func`1<TResult_REF>) <0x53>
          #07 Firebase.Firestore.Query/<Listen>c__AnonStorey0:<>m__0 (Firebase.Firestore.QuerySnapshotProxy,Firebase.Firestore.FirestoreError,string) <0xe7>
          #08 Firebase.Firestore.Query:QuerySnapshotsHandler (int,intptr,Firebase.Firestore.FirestoreError,string) <0x8b>
          #09 (wrapper native-to-managed) Firebase.Firestore.Query:QuerySnapshotsHandler (int,intptr,Firebase.Firestore.FirestoreError,intptr)
          #10 (wrapper managed-to-native) Firebase.AppUtilPINVOKE:PollCallbacks ()
          #11 Firebase.AppUtil:PollCallbacks () <0x7>
          #12 Firebase.Platform.FirebaseAppUtils:PollCallbacks () <0xf>
          #13 Firebase.Platform.FirebaseHandler:Update () <0x47>
          #14 Firebase.Platform.FirebaseMonoBehaviour:Update () <0x57>
          #15 (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
    
        at libc.abort(abort:58)
        at libart.art::Runtime::Abort(char const*)(Abort:1664)
        at libbase.android::base::LogMessage::~LogMessage()(~LogMessage:494)
        at libart.art::JavaVMExt::JniAbort(char const*, char const*)(JniAbort:1214)
        at libart.art::JNI::CallObjectMethodV(_JNIEnv*, _jobject*, _jmethodID*, std::__va_list)(CallObjectMethodV:1020)
        at libFirebaseCppApp-7_0_1._JNIEnv::CallObjectMethod(_jobject*, _jmethodID*, ...)(CallObjectMethod:16)
        at libFirebaseCppApp-7_0_1.std::__ndk1::enable_if<!(is_same<firebase::firestore::DocumentChangeTypeInternal, void>::value), firebase::firestore::jni::ResultTypeMap<firebase::firestore::DocumentChangeTypeInternal, IsPrimitive<firebase::firestore::jni::JniTypeMap<std::__ndk1::decay<firebase::firestore::DocumentChangeTypeInternal>::type>::type>::value>::type>::type firebase::firestore::jni::Env::CallHelper<firebase::firestore::DocumentChangeTypeInternal, _jobject* (_JNIEnv::*&)(_jobject*, _jmethodID*, ...), _jobject*, _jmethodID*>(_jobject* (_JNIEnv::*&&&)(_jobject*, _jmethodID*, ...), _jobject*&&, _jmethodID*&&)(enable_if<!:62)
        at libFirebaseCppApp-7_0_1.firebase::firestore::jni::ResultTypeMap<firebase::firestore::DocumentChangeTypeInternal, IsPrimitive<firebase::firestore::jni::JniTypeMap<std::__ndk1::decay<firebase::firestore::DocumentChangeTypeInternal>::type>::type>::value>::type firebase::firestore::jni::Env::Call<firebase::firestore::DocumentChangeTypeInternal>(firebase::firestore::jni::Object const&, firebase::firestore::jni::Method<firebase::firestore::DocumentChangeTypeInternal> const&)(DocumentChangeTypeInternal>:46)
        at libFirebaseCppApp-7_0_1.firebase::firestore::DocumentChangeInternal::type() const(type:30)
        at Firebase.Firestore.FirestoreCppPINVOKE.DocumentChangeProxy_type (System.Runtime.InteropServices.HandleRef)(Native Method)
        at Firebase.Firestore.DocumentChangeProxy.type ()(0x2b:43)
        at Firebase.Firestore.DocumentChange.get_ChangeType ()(0x23:35)
        at CorrespondenceMode.LoadMatch (Firebase.Firestore.QuerySnapshot)(0x7b:123)
        at Firebase.Firestore.Query.<Listen>c__AnonStorey0.<Listen>c__AnonStorey1.<>m__0 ()(0x63:99)
        at Firebase.Dispatcher.Run<TResult_REF> (System.Func`1<TResult_REF>)(0x63:99)
        at Firebase.Platform.FirebaseHandler.RunOnMainThread<TResult_REF> (System.Func`1<TResult_REF>)(0x53:83)
        at Firebase.Firestore.Query.<Listen>c__AnonStorey0.<>m__0 (Firebase.Firestore.QuerySnapshotProxy,Firebase.Firestore.FirestoreError,string)(0xe7:231)
        at Firebase.Firestore.Query.QuerySnapshotsHandler (int,intptr,Firebase.Firestore.FirestoreError,string)(0x8b:139)
        at Firebase.Firestore.Query.QuerySnapshotsHandler (int,intptr,Firebase.Firestore.FirestoreError,intptr)(Native Method)
        at Firebase.AppUtilPINVOKE.PollCallbacks ()(Native Method)
        at Firebase.AppUtil.PollCallbacks ()(0x7:7)
        at Firebase.Platform.FirebaseAppUtils.PollCallbacks ()(0xf:15)
        at Firebase.Platform.FirebaseHandler.Update ()(0x47:71)
        at Firebase.Platform.FirebaseMonoBehaviour.Update ()(0x57:87)
        at System.Object.runtime_invoke_void__this__ (object,intptr,intptr,intptr)(Native Method)

It also happens with Firebase Unity quickstarts. Reproduction rate is 100%.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions