Coder Social home page Coder Social logo

arunkumar9t2 / compass Goto Github PK

View Code? Open in Web Editor NEW
18.0 3.0 1.0 3.52 MB

🧭 Collection of Kotlin APIs/tools to make using Realm Mobile database easier

Home Page: https://arunkumar9t2.github.io/compass

License: Apache License 2.0

Kotlin 98.41% Dockerfile 1.59%
realm android mongodb-realm jetpack-paging jetpack realm-java realm-mobile-database

compass's Issues

Crash in paging when calling adapter#refresh

Hi
While testing your paging library I noticed this crash when refreshing page:

java.lang.IllegalStateException: Realm accessed from incorrect thread. in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsResults.cpp line 461
        at io.realm.internal.OsResults.nativeIsValid(Native Method)
        at io.realm.internal.OsResults.isValid(OsResults.java:700)
        at io.realm.OrderedRealmCollectionImpl.isValid(OrderedRealmCollectionImpl.java:78)
        at io.realm.RealmResults.isValid(RealmResults.java:71)
        at dev.arunkumar.compass.paging.RealmTiledDataSource._init_$lambda-1(RealmTiledDataSource.kt:111)
        at dev.arunkumar.compass.paging.RealmTiledDataSource.$r8$lambda$bRdLcJUylTJ0at1Xd1D1b6ya11s(Unknown Source:0)
        at dev.arunkumar.compass.paging.RealmTiledDataSource$$ExternalSyntheticLambda0.onInvalidated(Unknown Source:2)
        at androidx.paging.DataSource$invalidateCallbackTracker$1.invoke(DataSource.kt:103)
        at androidx.paging.DataSource$invalidateCallbackTracker$1.invoke(DataSource.kt:103)
        at androidx.paging.InvalidateCallbackTracker.invalidate$paging_common(InvalidateCallbackTracker.kt:89)
        at androidx.paging.DataSource.invalidate(DataSource.kt:395)
        at androidx.paging.LegacyPagingSource$2.invoke(LegacyPagingSource.kt:50)
        at androidx.paging.LegacyPagingSource$2.invoke(LegacyPagingSource.kt:48)
        at androidx.paging.PagingSource$invalidateCallbackTracker$1.invoke(PagingSource.kt:84)
        at androidx.paging.PagingSource$invalidateCallbackTracker$1.invoke(PagingSource.kt:84)
        at androidx.paging.InvalidateCallbackTracker.invalidate$paging_common(InvalidateCallbackTracker.kt:89)
        at androidx.paging.PagingSource.invalidate(PagingSource.kt:336)
        at androidx.paging.PageFetcher.generateNewPagingSource(PageFetcher.kt:204)
        at androidx.paging.PageFetcher.access$generateNewPagingSource(PageFetcher.kt:31)
        at androidx.paging.PageFetcher$generateNewPagingSource$1.invokeSuspend(Unknown Source:15)
        (Coroutine boundary)

Exception while computing database live data

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.