Description
Steps to Reproduce
I have a scenario where the database is closed and reopened after initialization. I am encountering an issue intermittently.
SQLCipher version (can be identified by executing PRAGMA cipher_version;
): 4.5.3
SQLCipher for Android version:
Are you able to reproduce this issue within the SQLCipher for Android test suite? No. Hard to reproduce locally.
01-11 12:18:01.655 10177 8943 9008 E ROOM : Invalidation tracker is initialized twice :/.
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: FATAL EXCEPTION: arch_disk_io_1
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: Process: com.telenav.launcher, PID: 8943
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: net.sqlcipher.database.SQLiteException: no such table: room_table_modification_log: , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1;
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteCompiledSql.compile(Unknown Source:15)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteCompiledSql.(Unknown Source:30)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteProgram.(Unknown Source:105)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteQuery.(SourceFile:4)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteDatabase.query(SourceFile:11)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at net.sqlcipher.database.SQLiteDatabase.query(SourceFile:6)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at androidx.room.RoomDatabase.query(SourceFile:5)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at androidx.room.RoomDatabase.query$default(Unknown Source:7)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at androidx.room.InvalidationTracker$refreshRunnable$1.checkUpdatedTable(Unknown Source:19)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at androidx.room.InvalidationTracker$refreshRunnable$1.run(Unknown Source:109)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
01-11 12:18:01.667 10177 8943 9085 E AndroidRuntime: at java.lang.Thread.run(Thread.java:923)
BTW: InvalidationTracker Line 438 catch Android's SQLiteException but here is net.sqlcipher.database.SQLiteException which extends from RuntimeException.
// This transaction has to be on the underlying DB rather than the RoomDatabase
// in order to avoid a recursive loop after endTransaction.
SupportSQLiteDatabase db = mDatabase.getOpenHelper().getWritableDatabase();
db.beginTransactionNonExclusive();
try {
invalidatedTableIds = checkUpdatedTable();
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
} catch (IllegalStateException | SQLiteException exception) {
// may happen if db is closed. just log.
Log.e(Room.LOG_TAG, "Cannot run invalidation tracker. Is the db closed?",
exception);
Thanks for your help.