realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
932 stars 57 forks source link

ANR during Realm.open [split_config.arm64_v8a.apk!librealmc.so] #1824

Open olliwear opened 3 weeks ago

olliwear commented 3 weeks ago

How frequently does the bug occur?

Sometimes

Description

We've updated Kotlin to v2.0.0 and Realm to v2.1.0 and are noticing a huge increase (>2000 in last couple of days) in ANRs on app start during Realm.open

Stacktrace & log output

main (native):tid=1 systid=3467 
#00 pc 0xae9ec libc.so (write + 12) (BuildId: 915f3092e188c08142d3ac57b655fbd7)
#01 pc 0x76995c split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#02 pc 0x769d00 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#03 pc 0x76b168 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#04 pc 0x752b7c split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#05 pc 0x6acef8 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#06 pc 0x6b41cc split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#07 pc 0x49a470 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#08 pc 0x49b4e8 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#09 pc 0x49b2fc split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#10 pc 0x4628b8 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#11 pc 0x3fdd04 split_config.arm64_v8a.apk + 1159168 (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
#12 pc 0x3c6294 split_config.arm64_v8a.apk (Java_io_realm_kotlin_internal_interop_realmcJNI_realm_1open + 20) (BuildId: 94c5f0ed17cee9345f507c7d769455896c0b6d82)
       at io.realm.kotlin.internal.interop.realmcJNI.realm_open(realmcJNI.java)
       at io.realm.kotlin.internal.interop.realmc.realm_open(realmc.java:435)
       at io.realm.kotlin.internal.interop.RealmInterop.realm_open(RealmInterop.kt:237)
       at io.realm.kotlin.internal.ConfigurationImpl.openRealm$lambda$0(ConfigurationImpl.kt:109)
       at io.realm.kotlin.internal.interop.NativePointerKt.use(NativePointer.kt:53)
       at io.realm.kotlin.internal.ConfigurationImpl.openRealm$suspendImpl(ConfigurationImpl.kt:108)
       at io.realm.kotlin.internal.ConfigurationImpl.openRealm(ConfigurationImpl.kt:1)
       at io.realm.kotlin.internal.RealmImpl$1.invokeSuspend(RealmImpl.kt:133)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt:1)
       at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking(CoroutineUtilsSharedJvm.kt:25)
       at io.realm.kotlin.internal.platform.CoroutineUtilsSharedJvmKt.runBlocking$default(CoroutineUtilsSharedJvm.kt:24)
       at io.realm.kotlin.internal.RealmImpl.<init>(RealmImpl.kt:115)
       at io.realm.kotlin.internal.RealmImpl.<init>(RealmImpl.kt:1)
       at io.realm.kotlin.internal.RealmImpl$Companion.create$io_realm_kotlin_library(RealmImpl.kt:318)
       at io.realm.kotlin.Realm$Companion.open(Realm.kt:83)
       ...
       at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711)
       at android.app.ActivityThread.-$$Nest$mhandleBindApplication(unavailable)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8919)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

2.1.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Android 10,11,12,13,14,15

Build environment

Android Studio version: Android Studio Koala | 2024.1.1 Android Build Tools version: 35.0.0 Android Gradle Plugin Version: 8.3.2 Gradle version: 8.7

sync-by-unito[bot] commented 3 weeks ago

➤ PM Bot commented:

Jira ticket: RKOTLIN-1122