Unfortunately, don't have any specific steps or code sample to reproduce. It is just randomly crash and it sometimes crashes in different places, but we cannot get it in Realm v2.3.1.
I found similar issue in realm-cocoa @ https://github.com/realm/realm-cocoa/issues/4422.
Realm version(s): 3.0.0
Realm sync feature enabled: no
Android Studio version: 2.3
Which Android version and device: Android 7.1.1 on Nexus 5X, Android 4.3 on Samsung S3 GT-I9300, Emulator Android
03-29 18:15:00.773 27003-27038 E/REALM: uncaught exception in notifier thread: N5realm10LogicErrorE: Bad version number
--------- beginning of crash
03-29 18:15:00.776 27003-27038 A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 27038 (-//-)
[ 03-29 18:15:00.785 367: 367 W/] debuggerd: handling request: pid=27003 uid=10376 gid=10376 tid=27038
03-29 18:15:01.005 27758-27758 A/DEBUG: * *
03-29 18:15:01.005 27758-27758 A/DEBUG: Build fingerprint: 'google/bullhead/bullhead:7.1.1/N4F26I/3532671:user/release-keys'
03-29 18:15:01.005 27758-27758 A/DEBUG: Revision: 'rev_1.0'
03-29 18:15:01.005 27758-27758 A/DEBUG: ABI: 'arm'
03-29 18:15:01.005 27758-27758 A/DEBUG: pid: 27003, tid: 27038, name: -//- >>> -//- <<<
03-29 18:15:01.005 27758-27758 A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
03-29 18:15:01.005 27758-27758 A/DEBUG: r0 00000000 r1 0000699e r2 00000006 r3 00000008
03-29 18:15:01.005 27758-27758 A/DEBUG: r4 e3e69978 r5 00000006 r6 e3e69920 r7 0000010c
03-29 18:15:01.005 27758-27758 A/DEBUG: r8 ff9c25c4 r9 decde3cc sl d106275c fp e3e698f4
03-29 18:15:01.005 27758-27758 A/DEBUG: ip 00000011 sp e3e69888 lr ec867557 pc ec869db4 cpsr 200f0010
03-29 18:15:01.015 27758-27758 A/DEBUG: backtrace:
03-29 18:15:01.017 27758-27758 A/DEBUG: #00 pc 00049db4 /system/lib/libc.so (tgkill+12)
03-29 18:15:01.017 27758-27758 A/DEBUG: #01 pc 00047553 /system/lib/libc.so (pthread_kill+34)
03-29 18:15:01.017 27758-27758 A/DEBUG: #02 pc 0001d8a5 /system/lib/libc.so (raise+10)
03-29 18:15:01.017 27758-27758 A/DEBUG: #03 pc 000193f1 /system/lib/libc.so (__libc_android_abort+34)
03-29 18:15:01.017 27758-27758 A/DEBUG: #04 pc 00017034 /system/lib/libc.so (abort+4)
03-29 18:15:01.017 27758-27758 A/DEBUG: #05 pc 0015d938 /data/app/{package}/base.apk (offset 0x1689000)
03-29 18:15:01.017 27758-27758 A/DEBUG: #06 pc 001307ec /data/app/{package}/base.apk (offset 0x1689000)
03-29 18:15:01.017 27758-27758 A/DEBUG: #07 pc 0013088c /data/app/{package}/base.apk (offset 0x1689000)
03-29 18:15:01.017 27758-27758 A/DEBUG: #08 pc 0015c828 /data/app/{package}/base.apk (offset 0x1689000)
03-29 18:15:01.017 27758-27758 A/DEBUG: #09 pc 00047023 /system/lib/libc.so (_ZL15__pthread_startPv+22)
03-29 18:15:01.017 27758-27758 A/DEBUG: #10 pc 00019e3d /system/lib/libc.so (__start_thread+6)
03-29 18:15:03.357 881-27759 W/ActivityManager: Force finishing activity *.MainActivity
They claim to have fixed it in https://github.com/realm/realm-object-store/pull/355 but if this happens in Realm 3.0.0 (and also Realm-Cocoa 2.4.2+?) then I guess it's not entirely fixed yet...?
_Sorry for making a mess with the tags_. Thanks for reporting this, @vadimbryl. I'll have someone look over what you've provided and follow-up with you.
Hey @vadimbryl ! Thanks for sending this. If you can provide any more information about how to reproduce it, that would be awesome.
@vadimbryl We did a bigger refactoring in 3.0.0 to support the fine grained collection notifications. Which is why this error cannot happen in 2.3.1.
But any clue on how to reproduce this would be much appreciated. If you can trigger this somewhat consistently with your own project, are you able to share that project? It can be done privately through [email protected].
This could be an error in object store. Somehow.
There is no doubt it is in the Object Store, but finding it without being able to reproduce it will be very hard.
@cmelchior I sent more information to [email protected]
I can reproduce your issue. Checking now.
Should be fixed by https://github.com/realm/realm-object-store/pull/424 waiting for review & release.
Hi, Is the fix released yet? I'm using 3.3.2 and I'm experiencing this issue now
Logcat
06-21 17:56:28.340 25639-25688/app.package.name E/REALM: uncaught exception in notifier thread: N5realm11SharedGroup10BadVersionE: std::exception
--------- beginning of crash
06-21 17:56:28.420 26854-25688/? A/google-breakpad: Microdump skipped (uninteresting)
06-21 17:56:28.452 25639-25688/app.package.name W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-21 17:56:28.452 25639-25688/app.package.name W/google-breakpad: Chrome build fingerprint:
06-21 17:56:28.452 25639-25688/app.package.name W/google-breakpad: 1.0
06-21 17:56:28.452 25639-25688/app.package.name W/google-breakpad: 1
06-21 17:56:28.452 25639-25688/app.package.name W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ###
06-21 17:56:28.452 25639-25688/app.package.name A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 25688 (.package.name)
[ 06-21 17:56:28.452 573: 573 W/ ]
debuggerd: handling request: pid=25639 uid=10296 gid=10296 tid=25688
06-21 17:56:28.469 26861-26861/? W/debuggerd64: type=1400 audit(0.0:26968): avc: denied { search } for name="com.google.android.gms" dev="sda35" ino=4898902 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
06-21 17:56:28.469 26861-26861/? W/debuggerd64: type=1400 audit(0.0:26969): avc: denied { search } for name="com.google.android.gms" dev="sda35" ino=2162941 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
06-21 17:56:28.473 26861-26861/? W/debuggerd64: type=1400 audit(0.0:26970): avc: denied { search } for name="com.google.android.gms" dev="sda35" ino=4898902 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
06-21 17:56:28.538 26861-26861/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
06-21 17:56:28.538 26861-26861/? A/DEBUG: Build fingerprint: 'google/sailfish/sailfish:7.1.2/NJH47B/4021576:user/release-keys'
06-21 17:56:28.538 26861-26861/? A/DEBUG: Revision: '0'
06-21 17:56:28.539 26861-26861/? A/DEBUG: ABI: 'arm64'
06-21 17:56:28.539 26861-26861/? A/DEBUG: pid: 25639, tid: 25688, name: .package.name >>> app.package.name <<<
06-21 17:56:28.539 26861-26861/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
06-21 17:56:28.539 26861-26861/? A/DEBUG: x0 0000000000000000 x1 0000000000006458 x2 0000000000000006 x3 0000000000000008
06-21 17:56:28.539 26861-26861/? A/DEBUG: x4 0000000000000002 x5 0000000000000000 x6 0000000000008080 x7 6277643939637372
06-21 17:56:28.539 26861-26861/? A/DEBUG: x8 0000000000000083 x9 ffffffffffffffdf x10 0000000000000000 x11 0000000000000001
06-21 17:56:28.539 26861-26861/? A/DEBUG: x12 ffffffffffffffff x13 ffffffffffffffff x14 0000000000000000 x15 ffffffffffffffff
06-21 17:56:28.539 26861-26861/? A/DEBUG: x16 00000070b723dee0 x17 00000070b71e72e4 x18 000000007150dbdc x19 000000709ade14f8
06-21 17:56:28.539 26861-26861/? A/DEBUG: x20 0000000000000006 x21 000000709ade1450 x22 0000000000000011 x23 00000070af07d340
06-21 17:56:28.539 26861-26861/? A/DEBUG: x24 000000709ade14d0 x25 00000000000fd000 x26 e60d101a1ca451af x27 0000000000000011
06-21 17:56:28.539 26861-26861/? A/DEBUG: x28 0000007ffe544c50 x29 000000709ade12e0 x30 00000070b71e478c
06-21 17:56:28.539 26861-26861/? A/DEBUG: sp 000000709ade12c0 pc 00000070b71e72ec pstate 0000000060000000
06-21 17:56:28.552 26861-26861/? A/DEBUG: backtrace:
06-21 17:56:28.552 26861-26861/? A/DEBUG: #00 pc 000000000006b2ec /system/lib64/libc.so (tgkill+8)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #01 pc 0000000000068788 /system/lib64/libc.so (pthread_kill+64)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #02 pc 0000000000023ce8 /system/lib64/libc.so (raise+24)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #03 pc 000000000001c76c /system/lib64/libc.so (abort+52)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #04 pc 000000000021e6a4 /data/app/app.package.name-1/lib/arm64/librealm-jni.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+348)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #05 pc 00000000001f0e48 /data/app/app.package.name-1/lib/arm64/librealm-jni.so (_ZN10__cxxabiv111__terminateEPFvvE+8)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #06 pc 00000000001f0eb4 /data/app/app.package.name-1/lib/arm64/librealm-jni.so (_ZSt9terminatev+12)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #07 pc 000000000021d44c /data/app/app.package.name-1/lib/arm64/librealm-jni.so
06-21 17:56:28.552 26861-26861/? A/DEBUG: #08 pc 0000000000067f90 /system/lib64/libc.so (_ZL15__pthread_startPv+196)
06-21 17:56:28.552 26861-26861/? A/DEBUG: #09 pc 000000000001d980 /system/lib64/libc.so (__start_thread+16)
@muthuraj57 can you reproduce this issue? if you can, would you please send your apk to [email protected] and let us know the steps to reproduce the issue? thanks.
@beeender I'm getting this crash consistently in a specific activity on my project. I'll try to extract that module alone in a new project and reproduce it.
Having the same issue, was on 3.0.0, upgraded to 3.4.0, problem persists.
For me, specifically, it seems to happen after a clean install of the app;
commitTransaction from pretty much any place crashes the appTypical crashlog:
07-04 16:37:52.568 20132-20205/com.appname E/REALM: uncaught exception in notifier thread: N5realm11SharedGroup10BadVersionE: std::exception
--------- beginning of crash
07-04 16:37:52.568 20132-20205/com.appname A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 20205 (.com.appname)
[ 07-04 16:37:52.568 1319: 1319 W/ ]
debuggerd: handling request: pid=20132 uid=10100 gid=10100 tid=20205
07-04 16:37:52.625 21058-21058/? A/DEBUG: pid: 20132, tid: 20205, name: .com.appname >>> com.appname <<<
07-04 16:37:52.626 21058-21058/? A/DEBUG: #05 pc 00230424 /data/app/com.appname-1/lib/x86/librealm-jni.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+452)
07-04 16:37:52.626 21058-21058/? A/DEBUG: #06 pc 001fdab7 /data/app/com.appname-1/lib/x86/librealm-jni.so (_ZN10__cxxabiv111__terminateEPFvvE+23)
07-04 16:37:52.626 21058-21058/? A/DEBUG: #07 pc 001fdb4f /data/app/com.appname-1/lib/x86/librealm-jni.so (_ZSt9terminatev+31)
07-04 16:37:52.626 21058-21058/? A/DEBUG: #08 pc 0022f03d /data/app/com.appname-1/lib/x86/librealm-jni.so
07-04 17:08:05.451 21058-21058/? E/audit: type=1701 msg=audit(1499180885.451:277): auid=4294967295 uid=10273 gid=10273 ses=4294967295 subj=u:r:untrusted_app:s0:c512,c768 pid=7522 comm=".com.appname" reason="memory violation" sig=6
@krummler Is it possible for you to reproduce this issue with a sample project? If it is difficult to reproduce it with a sample project, is it OK to share your apk with us and let us know how to reproduce it? you can send you apk to [email protected].
@beeender After some more searching I managed to figure out my problem.
It seemed on some circumstances my app triggered a task to remove local files (including the Realm file). This will result this previously mentioned crash if you:
I would expect realm to misbehave, but the particular error seems very confusing.
You can find a sample project here: https://github.com/krummler/realmcrashexample
Just run it to see the crash
@krummler Glad to know the problem has been identified !!! I checked your project and thought about to make a better error message. But It seems to be difficult. The major thing is checking the file existence/valid on some hot code path may slow down things a lot ...
But this information is very interesting!! I don't know deleting files when async query alive could lead to a badversion error. Thanks a lot for reporting this!
@beeender you are very welcome! 馃槃 I didn't know the query runs asynchronously, that clears things up a bit.
If I figure out any other details it'll be sure to get back to you.
I get this crash in 4.1.0
When I configure Realm in following way:
Realm.setDefaultConfiguration(new RealmConfiguration.Builder()
.directory(realmDirectory)
.name(Constants.Db.NAME)
.schemaVersion(Constants.Db.VERSION)
.build()
);
And directory is placed on external storage - getExternalFilesDir(null)
The crash is happened when I query my objects and write it to file as json.
If I commented configuration and realm is working with internal storage than I don't have this crash.
UPDATE: I found a fix when writing this message =)
I used this method to extract objects, where I transformed RealmResults to array of objects
RealmList<***> objects = new RealmList<>();
objects.addAll(Realm.getDefaultInstance()
.where(***.class)
.findAllSorted(***.FIELD_POSITION));
return objects;
Now I switched to RealmResults and use them to get non-manager objects to write it to json file.
And it works!
Reproduced on 7.1.1 and 6.0. And I get different logs on these devices:
Logs from 6.0 (emulator):
10-24 11:42:40.525 3589-3671/com.***.android E/REALM_JNI: jni: ThrowingException 7, std::exception in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_Collection.cpp line 130, .
10-24 11:42:40.525 3589-3671/com.***.android E/REALM_JNI: Exception has been thrown: std::exception in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_Collection.cpp line 130
10-24 11:42:40.549 3589-3671/com.***.android E/AndroidRuntime: FATAL EXCEPTION: IntentService[BackupService]
Process: com.***.android, PID: 3589
io.realm.internal.async.BadVersionException: std::exception in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_Collection.cpp line 130
at io.realm.internal.Collection.nativeGetRow(Native Method)
at io.realm.internal.Collection.getUncheckedRow(Collection.java:356)
at io.realm.internal.Collection$Iterator.get(Collection.java:118)
at io.realm.internal.Collection$Iterator.next(Collection.java:83)
at java.util.AbstractCollection.addAll(AbstractCollection.java:76)
at com.***.android.db.Db.getObjects()
Trace from 7.1.1
10-24 10:45:31.327 32549-32658/com.***.android E/REALM: uncaught exception in notifier thread: N5realm11SharedGroup10BadVersionE: std::exception
10-24 10:45:31.331 32549-32658/com.***.android A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 32658 (***.android)
10-24 10:45:31.423 792-792/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-24 10:45:31.424 792-792/? A/DEBUG: UUID: ce00e632-55b7-445a-8e76-e6bf9bcde863
10-24 10:45:31.424 792-792/? A/DEBUG: Build fingerprint: 'Sony/E5823/E5823:7.1.1/32.4.A.1.54/3761073091:user/release-keys'
10-24 10:45:31.424 792-792/? A/DEBUG: Revision: '0'
10-24 10:45:31.424 792-792/? A/DEBUG: ABI: 'arm64'
10-24 10:45:31.424 792-792/? A/DEBUG: pid: 32549, tid: 32658, name: ***.android >>> com.***.android <<<
10-24 10:45:31.425 792-792/? A/DEBUG: signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10-24 10:45:31.425 792-792/? A/DEBUG: x0 0000000000000000 x1 0000000000007f92 x2 0000000000000006 x3 0000000000000008
10-24 10:45:31.425 792-792/? A/DEBUG: x4 0000000000000002 x5 0000000000000000 x6 0000000000008080 x7 6277643939637372
10-24 10:45:31.425 792-792/? A/DEBUG: x8 0000000000000083 x9 ffffffffffffffdf x10 0000000000000000 x11 0000000000000001
10-24 10:45:31.425 792-792/? A/DEBUG: x12 ffffffffffffffff x13 ffffffffffffffff x14 0000000000000000 x15 2e8ba2e8ba2e8ba3
10-24 10:45:31.425 792-792/? A/DEBUG: x16 0000007fb3748ed8 x17 0000007fb36f6968 x18 000000007267e138 x19 0000007f89d204f8
10-24 10:45:31.425 792-792/? A/DEBUG: x20 0000000000000006 x21 0000007f89d20450 x22 0000000000000011 x23 0000007fb0064050
10-24 10:45:31.425 792-792/? A/DEBUG: x24 0000007f89d204d0 x25 00000000000fd000 x26 760b8f71d0a49811 x27 000000000000000d
10-24 10:45:31.426 792-792/? A/DEBUG: x28 0000007fcc6aba10 x29 0000007f89d202e0 x30 0000007fb36f3df8
10-24 10:45:31.426 792-792/? A/DEBUG: sp 0000007f89d202c0 pc 0000007fb36f6970 pstate 0000000060000000
10-24 10:45:31.445 792-792/? A/DEBUG: backtrace:
10-24 10:45:31.445 792-792/? A/DEBUG: #00 pc 000000000006b970 /system/lib64/libc.so (tgkill+8)
10-24 10:45:31.446 792-792/? A/DEBUG: #01 pc 0000000000068df4 /system/lib64/libc.so (pthread_kill+64)
10-24 10:45:31.446 792-792/? A/DEBUG: #02 pc 0000000000024290 /system/lib64/libc.so (raise+24)
10-24 10:45:31.446 792-792/? A/DEBUG: #03 pc 000000000001ccac /system/lib64/libc.so (abort+52)
10-24 10:45:31.446 792-792/? A/DEBUG: #04 pc 0000000000243554 /data/app/com.***.android-1/lib/arm64/librealm-jni.so (_ZN9__gnu_cxx27__verbose_terminate_handlerEv+348)
10-24 10:45:31.446 792-792/? A/DEBUG: #05 pc 0000000000216d70 /data/app/com.***.android-1/lib/arm64/librealm-jni.so (_ZN10__cxxabiv111__terminateEPFvvE+8)
10-24 10:45:31.446 792-792/? A/DEBUG: #06 pc 0000000000216ddc /data/app/com.***.android-1/lib/arm64/librealm-jni.so (_ZSt9terminatev+12)
10-24 10:45:31.446 792-792/? A/DEBUG: #07 pc 00000000002422c8 /data/app/com.***.android-1/lib/arm64/librealm-jni.so
10-24 10:45:31.446 792-792/? A/DEBUG: #08 pc 00000000000685fc /system/lib64/libc.so (_ZL15__pthread_startPv+196)
10-24 10:45:31.446 792-792/? A/DEBUG: #09 pc 000000000001def0 /system/lib64/libc.so (__start_thread+16)
10-24 10:45:32.881 825-825/? E/nativedumper:FW: parser.c(74): Failed to find expected node from: //mem_desc[@path]
10-24 10:45:32.937 825-825/? E/nativedumper:FW: utils.c(256): mkdir (/data/crashdata) failed. File exists
10-24 10:45:32.945 825-825/? E/nativedumper:FW: ramdump_framework.c(317): fp is NULL
10-24 10:45:32.945 825-825/? E/nativedumper:FW: ramdump_framework.c(498): Read-only file system
Realm.getDefaultInstance().where
That's a time bomb (unclosed Realm instance)
@pavel-ismailov I created a new issue #5459 to track this. Looks like a regression somewhere.
Can you share your project which can reproduce the issue? a minimal project will be perfect. you can send it to [email protected] if you want to share it privately.
Let's discuss under #5459