Realm-java: ANR after upgrading to 0.90.1 from v0.88.x

Created on 19 May 2016  Â·  9Comments  Â·  Source: realm/realm-java

Hi, @hohnamkung from VCNC reported ANR issue.

After they upgrade to v0.90.1, ANR happens from Realm.
It happens from our chatting feature, and i reproduce it very easily.

I attached traces.txt
traces.txt

Steps & Code to Reproduce

  1. Go to Chatting menu
  2. have a chat.
    90% reproducible.

    Version of Realm and tooling

Realm version : reproducible with Realm-java 0.90.1
It was ok when using v0.88.x

Device : The device that i'm using is Galaxy S6

APK for reproduce

If trace log is not enough, I will try to get APK to reproduce

T-Bug

Most helpful comment

Sorry for wrong decription.I thinks it starts to happen after equals and hashcode method overrided.

I'll share more detail information in tomorrow.

All 9 comments

Sorry for wrong decription.I thinks it starts to happen after equals and hashcode method overrided.

I'll share more detail information in tomorrow.

@hohnamkung We'll wait for your feedback. Thank you!

I'm working at VCNC with @hohnamkung.
It works fine when I clear app data.
But after app updated, ANR happens always when we try to send a message. (after calling Realm#beginTransaction.)

@psycholic4 Can you post the code inside the transaction? or do you mean it blocks on beginTransaction ?

It blocks on beginTransaction

That will also happen if you have another transaction open elsewhere. Do you know if that could be the case?

We use lots of transaction block when tcp connected (app started,), but it's fine.
Until now, only call from sending message reproduces this issue.

We found the cause of this issue.
Below is the code block in last transaction before sending message.

RealmResults results = realm.where(RMessageView.class).equalTo("status", "A"),findAll();
while (results.size() > 0) {
    results.first().setStatus("B");
}

Before realm version 0.89.0 it works fine.
But after this, it reproduces a infinite loop, so transaction never finished.
After than we call beginTransaction again, so ANR happens.

This problem is well explained at
https://realm.io/news/realm-java-0.89.0/
But we miss this because we just saw a CHANGELOG.md at github only.

Sorry for all.

No problem.

Was this page helpful?
0 / 5 - 0 ratings