androidandroid-roomandroidx

androidx crashing the app with a SQLiteDiskIOException


I do not have any database-related code in my android app. Still, I do see database-related crashes from the usage of androidx in my app. Please help me understand and find a fix for this issue.

Fatal Exception: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 4874): , while compiling: PRAGMA journal_mode
       at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
       at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:897)
       at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:642)
       at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:323)
       at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:294)
       at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218)
       at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:196)
       at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:464)
       at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:186)
       at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:178)
       at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:916)
       at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:893)
       at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:796)
       at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:1309)
       at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:268)
       at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)
       at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)
       at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper$OpenHelper.getWritableSupportDatabase(FrameworkSQLiteOpenHelper.java:92)
       at androidx.sqlite.db.framework.FrameworkSQLiteOpenHelper.getWritableDatabase(FrameworkSQLiteOpenHelper.java:53)
       at androidx.room.RoomDatabase.beginTransaction(RoomDatabase.java:328)
       at androidx.work.impl.utils.ForceStopRunnable.cleanUp(ForceStopRunnable.java:135)
       at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:79)
       at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:75)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
       at java.lang.Thread.run(Thread.java:818)

Solution

  • Based on this issue and this issue, you may be out of disk space.

    WorkManager stores job information in a SQLite database, and that is where you are crashing.

    It appears that a future version of WorkManager (2.6.x) might offer better APIs for dealing with this case.