question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime SQLite Table crash after upgrading Core and Messaging Versions

See original GitHub issue

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: 3.6.3
  • Firebase Component: Core & Messaging
  • Component version: Core 17.4.1 & Messaging 20.1.7

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

We recently updated our Firebase Messaging version from 19.0.1 to 20.1.7 and Firebase Core from 17.0.0 to 17.4.1 .

After doing so, when we relaunched our app, a crash surfaced related to the package: com.google.android.datatransport

Here is the stack trace:

Process: com.sproutsocial.android.debug, PID: 11938
    android.database.sqlite.SQLiteException: table event_payloads already exists (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE event_payloads (sequence_num INTEGER NOT NULL, event_id INTEGER NOT NULL, bytes BLOB NOT NULL,FOREIGN KEY (event_id) REFERENCES events(_id) ON DELETE CASCADE,PRIMARY KEY (sequence_num, event_id))
        at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
        at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:986)
        at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:593)
        at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
        at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:61)
        at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:33)
        at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1805)
        at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1733)
        at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.lambda$static$3(com.google.android.datatransport:transport-runtime@@2.2.1:109)
        at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager$$Lambda$4.upgrade(Unknown Source:0)
        at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.upgrade(com.google.android.datatransport:transport-runtime@@2.2.1:182)
        at com.google.android.datatransport.runtime.scheduling.persistence.SchemaManager.onUpgrade(com.google.android.datatransport:transport-runtime@@2.2.1:152)
        at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:417)
        at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:317)
        at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore$$Lambda$1.produce(Unknown Source:2)
        at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.retryIfDbLocked(com.google.android.datatransport:transport-runtime@@2.2.1:517)
        at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.getDb(com.google.android.datatransport:transport-runtime@@2.2.1:82)
        at com.google.android.datatransport.runtime.scheduling.persistence.SQLiteEventStore.runCriticalSection(com.google.android.datatransport:transport-runtime@@2.2.1:549)
        at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer.lambda$ensureContextsScheduled$1(com.google.android.datatransport:transport-runtime@@2.2.1:54)
        at com.google.android.datatransport.runtime.scheduling.jobscheduling.WorkInitializer$$Lambda$1.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

I could reproduce it by having a version of the app, which had the old firebase version installed, and then upgrading the apk to the app with the updated firebase versions.

It’s unclear if this crash and upgrade of Firebase Versions are related.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
marius-bardancommented, May 19, 2020

seeing this as well. app is crashing in a loop. only workaround is uninstall or clearing data.

We’re using both firebase-messaging:20.1.6 and firebase-crashlytics:17.0.0, so I’m not sure which one is the culprit as both seem to link against ‘transport-runtime’. We’re using android gradle plugin version 3.5.3.

1reaction
ashwinraghavcommented, May 18, 2020

If you have seen this issue only during development, and have not shipped versions of your app that go back and forth between versions, it should be safe to roll forward with your app pointing to the latest versions. If your users are actually seeing these crashes as a result of releases of your app having such version fluidity of firebase dependencies, Have your users delete their local state (cache and disk) in the app. Other programmatic fixes such as deleting the table in your app could be error prone in the long term. Sry bout the pain. We’re trying to support this version fluidity a bit better going forward!

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashes in Release mode due to Firebase dependency
I have tried detecting if Google Play Service is available first thing in the launcher activity so that i can show the user...
Read more >
Result and Error Codes - SQLite
The SQLITE_ERROR_MISSING_COLLSEQ result code means that an SQL statement could not be prepared because a collating sequence named in that SQL ...
Read more >
How SQLite Is Tested
Crash testing seeks to demonstrate that an SQLite database will not go corrupt if the application or operating system crashes or if there...
Read more >
Recent News - SQLite
2022-01-06 - Version 3.37.​​ 2 fixes a database corruption bug. You are encouraged to upgrade, especially if you are using SAVEPOINT.
Read more >
Release History Of SQLite
Improvements to error messages generated by faulty common table ... When doing an UPDATE or DELETE using a multi-column index where only a ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found