firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

Firebase Internal Foreign key constraint error

Open stephanenicolas opened this issue 5 years ago • 115 comments

When enable foreign key constraint in our app using :

//https://stackoverflow.com/a/12531927/693752
db.setForeignKeyConstraintsEnabled(true);

we see an internal error in the logcat coming from an internal database schema definition from firebase:

04-16 21:34:57.852  6738  8269 E SQLiteDatabase: Error inserting period=0 target_class=com.firebase.jobdispatcher.GooglePlayReceiver required_network_type=0 runtime=1555450497848 extras={"com.firebase.jobdispatcher.tag":{"com.company.REGISTER":4},"com.firebase.jobdispatcher.trigger_type":{"1":0},"com.firebase.jobdispatcher.replace_current":{"true":3},"com.firebase.jobdispatcher.persistent":{"2":0},"registration_id":{"dIu14E5WNzw:APA91bEheSYPxZM5T_wHaiFcP_EZTHqEuVU0GWT58D-1wlrjUhMzmbrmyeWTjUfLy3zBCqJrf7mwASZlBFqkqdlNMs7hsRh2WPJwa4I4eLrJeAkzZMYZGIZ-fccj4C8zLRbSEDbuMlvu":4},"com.firebase.jobdispatcher.maximum_backoff_seconds":{"3600":0},"com.firebase.jobdispatcher.initial_backoff_seconds":{"30":0},"com.firebase.jobdispatcher.retry_policy":{"1":0},"com.firebase.jobdispatcher.window_end":{"0":0},"com.firebase.jobdispatcher.service":{"com.company.SomeService":4},"com.firebase.jobdispatcher.recurring":{"false":3},"com.firebase.jobdispatcher.constraints":{"2":0},"com.firebase.jobdispatcher.window_start":{"0":0}} source=8 target_package=com.company.dev source_version=1 last_runtime=0 user_id=0 job_id=-1 requires_charging=0 tag=com.company.REGISTER flex_time=0 task_type=0 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}}
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:782)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1474)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1343)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at zxx.a(:com.google.android.gms@[email protected] (040700-239467275):148)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at aaat.a(:com.google.android.gms@[email protected] (040700-239467275):166)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at aaat.a(:com.google.android.gms@[email protected] (040700-239467275):8)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at aaat.a(:com.google.android.gms@[email protected] (040700-239467275):157)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at zxu.run(:com.google.android.gms@[email protected] (040700-239467275):2)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at rrt.b(:com.google.android.gms@[email protected] (040700-239467275):32)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at rrt.run(:com.google.android.gms@[email protected] (040700-239467275):21)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at rxx.run(Unknown Source:7)
04-16 21:34:57.852  6738  8269 E SQLiteDatabase: 	at java.lang.Thread.run(Thread.java:764)

stephanenicolas avatar Apr 16 '19 21:04 stephanenicolas

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Apr 16 '19 21:04 google-oss-bot

@stephanenicolas Thanks for filing this issue. To help you further, can you let us know what Firebase SDKs you are using? Thank you!

schmidt-sebastian avatar Apr 16 '19 22:04 schmidt-sebastian

FIREBASE_APPINDEXING_VERSION=16.0.2 FIREBASE_MESSAGING_VERSION=17.3.3 FIREBASE_CORE_VERSION=16.0.4 FIREBASE_IID_VERSION=17.0.3

Le mar. 16 avr. 2019 à 15:11, Sebastian Schmidt [email protected] a écrit :

@stephanenicolas https://github.com/stephanenicolas Thanks for filing this issue. To help you further, can you let us know what Firebase SDKs you are using? Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-android-sdk/issues/361#issuecomment-483863164, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33dSOMT70CpNkuhoGpvPShEOrgSdTks5vhkqCgaJpZM4czxRL .

stephanenicolas avatar Apr 16 '19 23:04 stephanenicolas

@schmidt-sebastian Can you confirm that this issue is not a blocker ? We want to enable foreign key constraints in our app but we are wondering if this error would break firebase.

stephanenicolas avatar Apr 17 '19 17:04 stephanenicolas

A co-worker told me that the bug might come from firebase job dispatcher: FIREBASE_JOB_DISPATCHER_VERSION=0.8.5

Le mar. 16 avr. 2019 à 16:45, Stéphane NICOLAS [email protected] a écrit :

FIREBASE_APPINDEXING_VERSION=16.0.2 FIREBASE_MESSAGING_VERSION=17.3.3 FIREBASE_CORE_VERSION=16.0.4 FIREBASE_IID_VERSION=17.0.3

Le mar. 16 avr. 2019 à 15:11, Sebastian Schmidt [email protected] a écrit :

@stephanenicolas https://github.com/stephanenicolas Thanks for filing this issue. To help you further, can you let us know what Firebase SDKs you are using? Thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-android-sdk/issues/361#issuecomment-483863164, or mute the thread https://github.com/notifications/unsubscribe-auth/ABv33dSOMT70CpNkuhoGpvPShEOrgSdTks5vhkqCgaJpZM4czxRL .

stephanenicolas avatar Apr 17 '19 18:04 stephanenicolas

We believe that this may actually be an issue internal to the GMSCore Scheduler API. Since this code is not available publicly, I will file an internal issue to get this resolved. I can't promise a timeline for this fix, and unfortunately I do not know if this issue should block your change. We also believe that this issue might be unrelated to calling setForeignKeyConstraintsEnabled.

If there are any other customers affected by this issue, I would appreciate that you let us know here.

schmidt-sebastian avatar Apr 17 '19 21:04 schmidt-sebastian

I have the same issue:

android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE)

not calling any db methods or even using SqlLite ourselves. Probably another package enabling constraints...which kind of points to poor DB design IMPO.

which, after searching led me here because of "pending_ops" schema hit on this search result.

relevant stack line: at sob.run(:com.google.android.gms@[email protected] (120400-309763488):7)

other info:

implementation 'com.google.android.gms:play-services-ads:19.0.1'
implementation 'com.google.android.gms:play-services-analytics:17.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-analytics:17.4.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'

is it firebase? /shrug

UPDATE:

here's the whole stack trace

2020-05-08 14:41:21.082 5299-24447/? E/SQLiteDatabase: Error inserting flex_time=738000 job_id=-1 period=1478000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=201516000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1588966881034 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0
    android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE)
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:879)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1599)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1468)
        at aplm.a(:com.google.android.gms@[email protected] (120400-309763488):76)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):173)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):21)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):167)
        at aphk.run(:com.google.android.gms@[email protected] (120400-309763488):8)
        at sob.b(:com.google.android.gms@[email protected] (120400-309763488):12)
        at sob.run(:com.google.android.gms@[email protected] (120400-309763488):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at sub.run(:com.google.android.gms@[email protected] (120400-309763488):0)
        at java.lang.Thread.run(Thread.java:919)

philn5d-ar avatar May 08 '20 19:05 philn5d-ar

The Firebase Database SDK doesn't access SQLite through GMSCore. I believe the stacktrace above is for an unrelated issue. Unfortunately, the trace is obfuscated so it is hard to trace this back to the original product.

schmidt-sebastian avatar May 08 '20 21:05 schmidt-sebastian

Thanks @schmidt-sebastian! Any pointers on how to track it down to the root? I'm only working with a contract dev to get some Android app work done, not well-versed in the inner workings of Android code. I'm building and running (in AVMs) via Android studio and these logs are coming through logcat if knowing that helps. Much appreciated!

philn5d-ar avatar May 11 '20 14:05 philn5d-ar

I haven't had do deal with obfuscated stacktraces since we moved to GitHub. Unfortunately, that means that I can't provide assistance here.

Maybe @samtstern has some pointers on how to de-obfuscate GMSCore stacktraces.

schmidt-sebastian avatar May 13 '20 05:05 schmidt-sebastian

I am having the same error, and it does not allow me to start the app.

 E/SQLiteDatabase: Error inserting period=6605000 preferred_charging_state=1 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService required_network_type=0 runtime=1589376728778 required_idleness_state=0 source=16 service_kind=0 target_package=com.google.android.gms source_version=201516000 last_runtime=0 user_id=0 job_id=-1 requires_charging=0 tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG flex_time=3302000 task_type=0 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}}
    android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067)
    #################################################################
    Error Code : 2067 (SQLITE_CONSTRAINT_UNIQUE)
    Caused By : Abort due to constraint violation.
    	(UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067))
    #################################################################
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:987)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:2007)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1874)
        at apnp.a(:com.google.android.gms@[email protected] (040306-309763488):76)
        at apne.a(:com.google.android.gms@[email protected] (040306-309763488):173)
        at apne.a(:com.google.android.gms@[email protected] (040306-309763488):21)
        at apne.a(:com.google.android.gms@[email protected] (040306-309763488):167)
        at apjn.run(:com.google.android.gms@[email protected] (040306-309763488):8)
        at ssd.b(:com.google.android.gms@[email protected] (040306-309763488):12)
        at ssd.run(:com.google.android.gms@[email protected] (040306-309763488):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at sye.run(:com.google.android.gms@[email protected] (040306-309763488):0)
        at java.lang.Thread.run(Thread.java:764)

If I remove the Crashlytics depedency, then it stops crashing and everything seems to work as normal, but of course I will not get crash reporting.

My dependencies:

    ext.google_play_services_version = '17.0.+'
...
  // Play Services
    implementation "com.google.android.gms:play-services-maps:${google_play_services_version}"
    implementation "com.google.android.gms:play-services-analytics:${google_play_services_version}"
    implementation "com.google.android.gms:play-services-ads:${google_play_services_version}"
    implementation "com.google.android.gms:play-services-auth:${google_play_services_version}"
    implementation "com.google.android.gms:play-services-auth-api-phone:17.4.0"

    // Firebase push notifications
    implementation "com.google.firebase:firebase-messaging:20.1.+"
    implementation 'com.google.firebase:firebase-core:17.2.+'

    // Crash and analytics
    implementation "com.google.firebase:firebase-crashlytics:17.0.0"
...

UPDATE: If I remove crashlytics, the log error is still there, but the application does not crash. So, somehow I think the error itself is not triggered by crashlytics, but the crash is. Maybe incorrectly handling the exception?

angelolloqui avatar May 13 '20 14:05 angelolloqui

Ok there's some crash going on that looks similar to some old GitHub issues I've found: https://github.com/googlearchive/firebase-jobdispatcher-android/issues/94 https://github.com/evernote/android-job/issues/87

Some internal bugs which may be related (for Googlers); https://b.corp.google.com/issues/156170585 https://b.corp.google.com/issues/149327697 https://b.corp.google.com/issues/146422649

I can't find the pattern here except that is has something to do with concurrency and job scheduling. Here's a random guess: I assume Crashlytics uses a second process to report crashes (otherwise it would be taken down by them) and maybe that process is not acquiring the right locks before trying to schedule the upload jobs?

Would need someone from the Crashlytics team to comment on what sort of Job scheduling it uses.

samtstern avatar May 13 '20 14:05 samtstern

Looks like Crashlytics uses DataTransport: https://cs.opensource.google/firebase-sdk/firebase-android-sdk/+/master:firebase-crashlytics/src/main/java/com/google/firebase/crashlytics/internal/send/DataTransportCrashlyticsReportSender.java

And DataTransport uses JobScheduler: https://cs.opensource.google/search?q=JobScheduler&ss=firebase-sdk

samtstern avatar May 13 '20 14:05 samtstern

It is correct that DataTransport uses JobScheduler, however unlike in the case of https://github.com/googlearchive/firebase-jobdispatcher-android/issues/94, JobScheduler does not use Play Services to fulfill its job.

I am not sure how using JobScheduler would manifest in the above stacktrace as they seem entirely unrelated.

Additionally, does the stacktrace actually originate in your app? or is it just part of unfiltered logcat output?

@angelolloqui when the crash does occur, are there any other stacktraces present in your logcat?

vkryachko avatar May 19 '20 16:05 vkryachko

Additionally, does the stacktrace actually originate in your app? or is it just part of unfiltered logcat output? Not sure if it originates inside or outside the app as a response of the app opening, but it is only triggered when I open the app.

@angelolloqui when the crash does occur, are there any other stacktraces present in your logcat?

Nothing that I was able to capture. If you have any hint I can try to reproduce and pause somewhere, but I wasn't able to find any other info so far. All I can tell is that the stack trace happens with or without Crashlytics, but when Crashlytics dependency is added it also results in a crash when opening. One additional tip is that I am only able to reproduce so far in a real device and not in emulators.

One extra detail, maybe not related, but since it happens during startup just in case, is that the app is a multidex one and it uses a largeHeap.

angelolloqui avatar May 19 '20 17:05 angelolloqui

One more thing I just reminded is that the app used to have Crashlytics active through Fabric without any issue. It has been since we moved to Firebase for it that it started crashing.

angelolloqui avatar May 19 '20 17:05 angelolloqui

One more thing I just reminded is that the app used to have Crashlytics active through Fabric without any issue. It has been since we moved to Firebase for it that it started crashing.

Same issue here, moved to firebase-crashlytics via react-native-firebase/crashlytics and since the update I also see the UNIQ constraint stacktrace during app start. Interestingly, crash reporting still works and crashes show up in Firebase.

MegaMaddin avatar May 21 '20 09:05 MegaMaddin

@MegaMaddin does the stacktrace come from your app or some other app(e.g. play services) on the device? Also, do your crash reports contain this UNIQ constraint stacktrace?

vkryachko avatar May 21 '20 14:05 vkryachko

In my case it's not a "real crash". App still works, but I can see the same stack trace in the adb logs.

acuntex avatar May 21 '20 15:05 acuntex

@mrwillis21 does crashlytics talk to play services in any way?

vkryachko avatar May 21 '20 15:05 vkryachko

@MegaMaddin does the stacktrace come from your app or some other app(e.g. play services) on the device? Also, do your crash reports contain this UNIQ constraint stacktrace?

@vkryachko that's the stacktrace immediately after app start-up:

E/SQLiteDatabase: Error inserting flex_time=3595000 job_id=-1 period=7192000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=201516000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1590052357409 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0
    android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE)
        at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
        at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:879)
        at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790)
        at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88)
        at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1599)
        at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1468)
        at aplm.a(:com.google.android.gms@[email protected] (120400-309763488):76)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):173)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):21)
        at aplb.a(:com.google.android.gms@[email protected] (120400-309763488):167)
        at aphk.run(:com.google.android.gms@[email protected] (120400-309763488):8)
        at sob.b(:com.google.android.gms@[email protected] (120400-309763488):12)
        at sob.run(:com.google.android.gms@[email protected] (120400-309763488):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at sub.run(:com.google.android.gms@[email protected] (120400-309763488):0)
        at java.lang.Thread.run(Thread.java:919)

And no, the reported stacktrace in Firebase (I used crashlytics().crash() just includes the CrashTest.java stacktrace.

MegaMaddin avatar May 22 '20 08:05 MegaMaddin

Same issue here after updating Firebase dependencies. Crashlytics also installed. Also use to be Fabric. App runs, but this stack trace shows in log at pretty much every navigation in the app. Worried this will cause issues if we release.

pangia avatar May 22 '20 22:05 pangia

@pangia what are your other firebase dependencies besides crashlytics(if any)?

this stack trace shows in log at pretty much every navigation in the app

It's interesting that the library in question(datatransport) only ever executes upon app crashes to upload crashes to crashlytics(unless you use other firebase products like In App Messaging), so unless that is the case, this stacktrace is unlikely related to datatransport at all.

vkryachko avatar May 25 '20 14:05 vkryachko

@mrwillis21 does crashlytics talk to play services in any way?

@vkryachko It does not.

mrwillis21 avatar May 26 '20 13:05 mrwillis21

@pangia what are your other firebase dependencies besides crashlytics(if any)?

this stack trace shows in log at pretty much every navigation in the app

It's interesting that the library in question(datatransport) only ever executes upon app crashes to upload crashes to crashlytics(unless you use other firebase products like In App Messaging), so unless that is the case, this stacktrace is unlikely related to datatransport at all.

Our dependencies: implementation 'com.google.firebase:firebase-core:17.4.1' implementation 'com.google.firebase:firebase-analytics:17.4.2' implementation 'com.google.firebase:firebase-database:19.3.0' implementation 'com.google.firebase:firebase-auth:19.3.1' implementation 'com.google.firebase:firebase-messaging:20.2.0' implementation 'com.google.firebase:firebase-config:19.1.4' implementation 'com.google.firebase:firebase-crashlytics:17.0.0' implementation 'com.google.android.gms:play-services-ads:19.1.0' implementation 'com.google.android.gms:play-services-games:19.0.0' implementation 'com.google.android.gms:play-services-base:17.2.1' implementation 'com.google.android.gms:play-services-analytics:17.0.0'

pangia avatar May 26 '20 13:05 pangia

Same here, I'm using several other Firebase services via RNFirebase:

    "@react-native-firebase/admob"
    "@react-native-firebase/analytics"
    "@react-native-firebase/app"
    "@react-native-firebase/crashlytics"
    "@react-native-firebase/dynamic-links"
    "@react-native-firebase/iid"
    "@react-native-firebase/in-app-messaging"
    "@react-native-firebase/remote-config"

MegaMaddin avatar May 26 '20 14:05 MegaMaddin

I am also facing this crash issue:

E/SQLiteDatabase: Error inserting flex_time=3340000 job_id=-1 period=6682000 source=16 requires_charging=0 preferred_network_type=1 target_class=com.google.android.gms.measurement.PackageMeasurementTaskService user_id=0 target_package=com.google.android.gms tag=Measurement.PackageMeasurementTaskService.UPLOAD_TASK_TAG task_type=0 required_idleness_state=0 service_kind=0 source_version=201817000 persistence_level=1 preferred_charging_state=1 required_network_type=0 runtime=1590520619376 retry_strategy={"maximum_backoff_seconds":{"3600":0},"initial_backoff_seconds":{"30":0},"retry_policy":{"0":0}} last_runtime=0 from {P:25120;U:10021} android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: pending_ops.tag, pending_ops.target_class, pending_ops.target_package, pending_ops.user_id (code 2067 SQLITE_CONSTRAINT_UNIQUE) at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method) at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:879) at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:790) at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:88) at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1639) at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1494) at apiz.a(:com.google.android.gms@[email protected] (120400-311416286):78) at apio.a(:com.google.android.gms@[email protected] (120400-311416286):196) at apio.a(:com.google.android.gms@[email protected] (120400-311416286):20) at apio.a(:com.google.android.gms@[email protected] (120400-311416286):190) at apex.run(:com.google.android.gms@[email protected] (120400-311416286):8) at sfd.b(:com.google.android.gms@[email protected] (120400-311416286):12) at sfd.run(:com.google.android.gms@[email protected] (120400-311416286):7) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at sld.run(:com.google.android.gms@[email protected] (120400-311416286):0) at java.lang.Thread.run(Thread.java:919)

Also getting this crash multiple times : https://github.com/firebase/firebase-android-sdk/issues/1593

Discovery-Prachi avatar May 26 '20 19:05 Discovery-Prachi

I suspect this is related to which version of SQL lite you are importing. Analytics and a few other Firebase tools depend on SQLite to cache data on device prior to batch upload. If you are using an old SQLite version in your app somewhere else this can cause the behavior you are seeing. Can be hard to track down, could be in a submodule.

Moving to triage as this isn't Crashlytics related.

TKBurner avatar May 28 '20 16:05 TKBurner

The origin might not be related to crashlytics directly, but it is the fact that crashlytics is added to the project what makes it crash, so there is some wrong handling within the lib. If I get rid of Crashlytics dependency, then the crash disappear.

angelolloqui avatar May 28 '20 16:05 angelolloqui

Confirmed that the SQLIte version being used is from API 29. Only get this error on a device, not in emulators. Also, it happens on every transition to a new intent/activity.

The error "Package unavailable for task: com.google.android.apps.plus/com.firebase.jobdispatcher.GooglePlayReceiver..." also appears right before the crash. JobDispatcher is deprecated, and not used by anything in our code or dependencies from what I can find. All of our dependencies are the latest version, but something is still puling it in.

Any ideas are appreciated, I'm not sure what else to try.

pangia avatar May 31 '20 15:05 pangia