objectbox-java: .removeAll() freezes indefinitely

#764 Issue Basics

  • ObjectBox version : 2.5.1, 3.0.0-alpha2
  • Reproducibility: always

Reproducing the bug

Description

When calling removeAll() on an Entity, DB operation freezes

Code

box.removeAll()

Entities

@Entity
data class MyEntity(
    @Id
    var id: Long? = null,
    @Uid(5199960888095114421L)
    var idA: Int? = null,
    @Uid(8980596607626398101L)
    var idB: String? = null,
    @Uid(8428670953150503097L)
    var idC: Int? = null
)

Misc

box.remove(box.all)

works

  • I’m calling all this in a worker
  • Earlier when enitites had a default values like " " for string etc, it worked, but now have made all such fields nullable with default null.
  • It works for the first time when app is installed ( In the worker, first removeAll and then put a list of entities), but when we sync again i.e. removeAll and put, it just freezes on removeAll
  • I’m also observing the DB.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (10 by maintainers)

Most upvoted comments

@greenrobot @greenrobot-team Thanks a lot guys! Just tested 2.7.0 and everything is working fine now ( will be testing more ).

Now I realise that it all started happening after I added relations. But adding relations, affected other plain (without relations) models also.

Can you please share how did you reproduced the issue? Thanks again

OK, having two versions with two outcomes is a good starting point. E.g. now you can adjust the working one step-by-step until it stops working to get closer to the cause…

Btw do you have any idea why remove(box.all) works?

It’s an interesting observation and I have no idea… (It’s also much more inefficient…) However, this changes some timings and transaction sequences (box.all is a read TX before doing a write TX).