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

"Application Not Responding" (ANR) issue

Open tebica opened this issue 11 years ago • 9 comments

This is from Korean app called Kakao Hello

Galaxy S6, Galaxy S6 Edge, Galaxy S6 Edge+, Galaxy Note5 (OS 5.1.1)

  • Reproduceable sometimes when contact tab scrolled or touching the screen
  • call log last call stack stopped at nativeGetString(), nativeIsNull()
  • They this function is not returned but blocked?

ANR LOG 1 (Main thread)


DALVIK THREADS (59):
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x88024000 self=0x7f82ca6000
| sysTid=27763 nice=-6 cgrp=default sched=0/0 handle=0x7f86a95e30
| state=R schedstat=( 0 0 0 ) utm=7487 stm=24231 core=6 HZ=100
| stack=0x7fe93a0000-0x7fe93a2000 stackSize=8MB
| held mutexes=
kernel: (couldn't read /proc/self/task/27763/stack)
native: #00 pc 000cf200 /data/app/com.kakao.hello-1/lib/arm64/librealm-jni.so (AES_decrypt+764)
native: #01 pc 000cfa90 /data/app/com.kakao.hello-1/lib/arm64/librealm-jni.so (CRYPTO_cbc128_decrypt+980)
at io.realm.internal.UncheckedRow.nativeGetString(Native method)
at io.realm.internal.UncheckedRow.getString(SourceFile:134)
at io.realm.RealmBizPlaceRealmProxy.getExtra(SourceFile:131)
at com.kakao.hello.data.api.model.BizPlace.valueOf(SourceFile:84)
at com.kakao.hello.data.api.model.Contact$Ui.valueOf(SourceFile:473)
at com.kakao.hello.ui.main.contact.ContactListAdapter.a(SourceFile:170)
at com.kakao.hello.ui.main.contact.ContactListAdapter.onBindViewHolder(SourceFile:145)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(SourceFile:5277)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(SourceFile:5310)
at android.support.v7.widget.RecyclerView$Recycler.a(SourceFile:4568)

at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(SourceFile:4461)
at ahc.a(SourceFile:1962)
at android.support.v7.widget.LinearLayoutManager.a(SourceFile:1371)
at android.support.v7.widget.LinearLayoutManager.a(SourceFile:1334)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(SourceFile:538)
at android.support.v7.widget.RecyclerView.i(SourceFile:2847)
at android.support.v7.widget.RecyclerView.onLayout(SourceFile:3145)

ANR LOG 2 (Main thread)

DALVIK THREADS (34):
"main" prio=5 tid=1 Native
| group="main" sCount=1 dsCount=0 obj=0x891c6e00 self=0x7f928a6000
| sysTid=28252 nice=0 cgrp=default sched=0/0 handle=0x7f967f9e30
| state=R schedstat=( 0 0 0 ) utm=1435 stm=7021 core=7 HZ=100
| stack=0x7ff24a0000-0x7ff24a2000 stackSize=8MB
| held mutexes=
kernel: (couldn't read /proc/self/task/28252/stack)
native: #00 pc 000cf200 /data/app/com.kakao.hello-1/lib/arm64/librealm-jni.so (AES_decrypt+764)
native: #01 pc 000cfa90 /data/app/com.kakao.hello-1/lib/arm64/librealm-jni.so (CRYPTO_cbc128_decrypt+980)
at io.realm.internal.TableQuery.nativeIsNull(Native method)
at io.realm.internal.TableQuery.isNull(SourceFile:682)
at io.realm.RealmQuery.isNull(SourceFile:186)
at io.realm.RealmQuery.isNotNull(SourceFile:198)
at com.kakao.hello.presenter.main.at.AtPresenterImpl.getMyBizPlaceList(SourceFile:195)
at com.kakao.hello.ui.main.at.AtFragment.onCreateView(SourceFile:125)
at android.support.v4.app.Fragment.a(SourceFile:1962)
at fb.a(SourceFile:1026)
at fb.a(SourceFile:1207)
at android.support.v4.app.BackStackRecord.run(SourceFile:738)
at fb.execPendingActions(SourceFile:1572)
at fb.executePendingTransactions(SourceFile:545)
at android.support.v4.app.FragmentPagerAdapter.finishUpdate(SourceFile:141)
at android.support.v4.view.ViewPager.a(SourceFile:1106)
at android.support.v4.view.ViewPager.c(SourceFile:952)
at android.support.v4.view.ViewPager.onMeasure(SourceFile:1474)

tebica avatar Oct 07 '15 17:10 tebica

Developer who reported this : @jungilhan

tebica avatar Oct 07 '15 17:10 tebica

[I'm not a realm dev] I think the problem might have to do with what was fixed in 0.83.0 as per Opening a Realm file from one thread will no longer be blocked by a write transaction from another thread, meaning you could get ANRs if you opened a realm during a write transaction.

Zhuinden avatar Oct 07 '15 21:10 Zhuinden

@Zhuinden Unfortunately that is not the case. That bug would trigger only when you opened the Realm not when reading some property.

cmelchior avatar Oct 08 '15 08:10 cmelchior

Apart from that, this looks really strange and we will need more info to be able to debug this.

  1. Looks like they are using encryption?
  2. Is it reproducible?
  3. Is it only happening on the Android 5.1.1 and only on Samsung devices?

cmelchior avatar Oct 08 '15 08:10 cmelchior

@cmelchior

  1. Yes. they are using encryption
  2. Kind of. They said it's hard but reproducible if they try
  3. Yes. Only Galaxy S6, Galaxy S6 Edge, Galaxy S6 Edge+, Galaxy Note5 (OS 5.1.1)

tebica avatar Oct 08 '15 10:10 tebica

If they could reproduce the behaviour in a minimal project that would help immensely. Then we would have some code we could test ourselves. Do you know if it is possible for them to reduce the code in that area.

cmelchior avatar Oct 08 '15 10:10 cmelchior

All those devices are ARM64. I wonder if it has something to do with it. Also, this is the source of the blocking function: https://github.com/mkrautz/openssl-mirror/blob/master/crypto/aes/aes_core.c#L972 On a quick glance all I see there is memory reading, writing and math operations. No locks as far as I can see.

It would be very nice to be able to replicate such issue. Any luck with it yet?

emanuelez avatar Oct 13 '15 19:10 emanuelez

Progress will be tracked by #1633.

kneth avatar Oct 21 '15 10:10 kneth

0.85.0 has been released which no longer uses POSIX signals for encryption. It should fix this issue.

cmelchior avatar Nov 19 '15 13:11 cmelchior