objectbox-java icon indicating copy to clipboard operation
objectbox-java copied to clipboard

DbException when trying to empty out crazy large entity

Open louis993546 opened this issue 7 years ago • 4 comments

Issue Basics

  • ObjectBox version: 1.4.1
  • Reproducibility: always

Reproducing the bug

Description

Basically I am trying to remove that table because it is getting ridiclously large (completely my fault), but I cannot do that because it just crash. I am trying to not clear data because other entity are still useful to me right now

Code

  • .maxSizeInKByte(5242880)
  • Populate an entity with 31065831 object
  • thatbox.removeAll()

Logs & stackstraces

io.objectbox.exception.DbException: Could not get from cursor (-30782) (error code -30782)
at io.objectbox.Cursor.nativeDeleteAll(Native Method)
at io.objectbox.Cursor.deleteAll(Cursor.java:207)
at io.objectbox.Box.removeAll(Box.java:512)
at io.github.louistsaitszho.datamodels.RepositoryImpl$clearOutdatedData$1.subscribe(RepositoryImpl.kt:300)
at io.reactivex.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:39)
at io.reactivex.Completable.subscribe(Completable.java:1794)
at io.reactivex.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
at io.reactivex.Scheduler$DisposeTask.run(Scheduler.java:571)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)

Entities

@Entity
data class RawAccelerationEntity(
    @Id var id: Long = 0,
    val type: Int,
    val timestamp: Long,
    val x: Float,
    val y: Float,
    val z: Float
)

louis993546 avatar Mar 14 '18 09:03 louis993546

We're still investigating a full solution, which will require some internal changes. Meanwhile, this gist is a workaround: https://gist.github.com/greenrobot/5078a4c86f4fadc5c25711b0a90ecf3a It will run for quite some time, but it's an option.

greenrobot avatar Mar 26 '18 15:03 greenrobot

Btw, ObjectBox 1.5 improved the issue: on 64 bit ABIs, this should not occur anymore.

greenrobot avatar Jul 05 '18 15:07 greenrobot

We're still investigating a full solution, which will require some internal changes. Meanwhile, this gist is a workaround: https://gist.github.com/greenrobot/5078a4c86f4fadc5c25711b0a90ecf3a It will run for quite some time, but it's an option.

With the release of version 2.7.0, this issue still seems to be persisting

mecoFarid avatar Sep 16 '20 12:09 mecoFarid

@mecoFarid Do you have some additional info?

greenrobot avatar Sep 16 '20 13:09 greenrobot