-
Type: Bug
-
Resolution: Cannot Reproduce
-
Priority: Critical - P2
-
Affects Version/s: None
-
Component/s: None
Goal
Keep a collection as a class field in looper thread and iterate through it periodically.
Actual Results
Crash.
Steps & Code to Reproduce
- Keep RealmResults<Item> items as a field in the android Service class.
- Iterate through the collection using for:
for (Item item : items) - The app crashes for some users.
My best guess is that the collection was being modified at the same moment, however, it had never happened before updating to realm 7.
Version of Realm and tooling
Realm version(s): 7.0.8
Realm Sync feature enabled: No
Android Studio version: 4.0/4.2
Android Build Tools version: 30.0.4
Gradle version: 5.6.1
Which Android version and device(s):
SAMSUNG-SM-T377A 6.0.1,
OnePlus 7 Pro, 10
Crash report from SAMSUNG-SM-T377A 6.0.1:
io.realm.exceptions.RealmError: Unrecoverable error. Key not found in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsResults.cpp line 98 at io.realm.internal.OsResults.nativeGetRow(SourceFile) at io.realm.internal.OsResults.a(SourceFile:8) at io.realm.internal.OsResults$b.a(SourceFile:3) at io.realm.internal.OsResults$b.next(SourceFile:4)
Crash report from OnePlus 7 Pro, 10:
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** pid: 0, tid: 0 >>> com.myapp.android <<< backtrace: #00 pc 00000000002a449c /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000011a324 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000011a25c /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000024802c /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 0000000000247f0c /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 0000000000247ac4 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000024c7e4 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 0000000000170124 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000016ebb8 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 000000000016ea50 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) #00 pc 0000000000118324 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/split_config.arm64_v8a.apk!lib/arm64-v8a/librealm-jni.so (offset 0x34000) (Java_io_realm_internal_OsResults_nativeGetRow+28) #00 pc 00000000001a8e00 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (art_jni_trampoline+160) #00 pc 00000000006254a8 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (io.realm.internal.OsResults.a+88) #00 pc 0000000000517ee0 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (io.realm.internal.OsResults$b.next+368) #00 pc 000000000038b058 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (com.myapp.app.sync.image.ImageDownloadService.e+4008) #00 pc 0000000000389ec8 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (com.myapp.app.sync.image.ImageDownloadService.d+56) #00 pc 000000000038d340 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (com.myapp.app.sync.image.ImageDownloadService.b+1328) #00 pc 0000000000283688 /data/app/com.myapp.android-pZ7LJ8m4VrFUowLDzWv6Vw==/oat/arm64/base.odex (com.myapp.app.sync.image.d.run+72) #00 pc 000000000074dedc /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+76) #00 pc 000000000075155c /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+1548) #00 pc 000000000074ff30 /system/framework/arm64/boot-framework.oat (android.os.HandlerThread.run+544) #00 pc 0000000000137334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) #00 pc 0000000000145fec /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244) #00 pc 00000000004b1448 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104) #00 pc 00000000004b255c /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416) #00 pc 00000000004f2f24 /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176) #00 pc 00000000000d6b70 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) #00 pc 0000000000074eac /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)