Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AndroidRuntime: net.sqlcipher.database.SQLiteException: no such table: room_table_modification_log: , while compiling: SELECT * FROM room_table_modification_log WHERE invalidated = 1; #640

Open
Alexanderlwz opened this issue Jan 12, 2024 · 2 comments

Comments

@Alexanderlwz
Copy link

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.

@developernotes
Copy link
Member

Hi @Alexanderlwz,

I suspect this may be a bug within the Room API, the same Room log message has been reported in the Google Issue Tracker 1 previously. You might consider reaching out there. Also, the android-database-sqlcipher library has been deprecated, sqlcipher-android is the long-term replacement 2.

Footnotes

  1. https://issuetracker.google.com/issues/65820362

  2. https://github.com/sqlcipher/android-database-sqlcipher#deprecated-library

@Alexanderlwz
Copy link
Author

Thank you, I'll migrate to sqlcipher-android.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants