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

Exception while computing database live data #8

Open
DmytroTols opened this issue Aug 16, 2023 · 0 comments
Open

Exception while computing database live data #8

DmytroTols opened this issue Aug 16, 2023 · 0 comments

Comments

@DmytroTols
Copy link

Hi, I'm using your library for my project and I started to get this exception, so let me guide you through my project, inside of worker I'm checking some data:
override suspend fun doWork(): Result {
//code
val reversals = Database.transactionRepository().findAllReversals()
//code
}
and here is my findAllReversals:
suspend fun findAllReversals(): List {
return dispatch {
RealmFunction { realm ->
realm.copyFromRealm(
realm.where().equalTo("_status", StatusType.UNKNOWN.name).findAll()
).toList()
}
}
}
So at some point of accessing data sometimes (rarely) my app just crashes with error:
java.lang.RuntimeException: Exception while computing database live data.
at androidx.room.RoomTrackingLiveData.refreshRunnable$lambda$0(RoomTrackingLiveData.kt:74)
at androidx.room.RoomTrackingLiveData.$r8$lambda$PhMGW5zFk4QWazERd2lfEeLZqW0(RoomTrackingLiveData.kt)
at androidx.room.RoomTrackingLiveData$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
at androidx.room.TransactionExecutor.execute$lambda$1$lambda$0(TransactionExecutor.kt:36)
at androidx.room.TransactionExecutor.$r8$lambda$AympDHYBb78s7_N_9gRsXF0sHiw(TransactionExecutor.kt)
at androidx.room.TransactionExecutor$$ExternalSyntheticLambda0.run(D8$$SyntheticClass)
at androidx.work.impl.utils.SerialExecutorImpl$Task.run(SerialExecutorImpl.java:96)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: android.database.CursorWindowAllocationException: Cursor window allocation of 2048 kb failed. # Open Cursors=1 (# cursors opened by this proc=1)
at android.database.CursorWindow.(CursorWindow.java:108)
at android.database.AbstractWindowedCursor.clearOrCreateWindow(AbstractWindowedCursor.java:198)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:138)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:219)
at android.database.AbstractCursor.moveToNext(AbstractCursor.java:268)
at androidx.work.impl.model.WorkSpecDao_Impl.__fetchRelationshipWorkTagAsjavaLangString(WorkSpecDao_Impl.java:2528)
at androidx.work.impl.model.WorkSpecDao_Impl.access$100(WorkSpecDao_Impl.java:36)
at androidx.work.impl.model.WorkSpecDao_Impl$15.call(WorkSpecDao_Impl.java:1103)
at androidx.work.impl.model.WorkSpecDao_Impl$15.call(WorkSpecDao_Impl.java:1074)
at androidx.room.RoomTrackingLiveData.refreshRunnable$lambda$0(RoomTrackingLiveData.kt:72)
... 9 more

Is there any walkarounds or fixes for that?

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

1 participant