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

ANR after upgrading to 0.90.1 from v0.88.x

Open tebica opened this issue 10 years ago • 9 comments

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

tebica avatar May 19 '16 09:05 tebica

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 avatar May 19 '16 10:05 hohnamkung

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

emanuelez avatar May 19 '16 12:05 emanuelez

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 avatar May 20 '16 04:05 psycholic4

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

cmelchior avatar May 20 '16 04:05 cmelchior

It blocks on beginTransaction

psycholic4 avatar May 20 '16 04:05 psycholic4

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

cmelchior avatar May 20 '16 04:05 cmelchior

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.

psycholic4 avatar May 20 '16 04:05 psycholic4

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.

psycholic4 avatar May 20 '16 05:05 psycholic4

No problem.

cmelchior avatar May 20 '16 05:05 cmelchior