Crash with signal 11 (SIGSEGV)
Hi Realm team!
We're using Realm 0.84.1, it works very well for us. But we've got some complaints from user about app crash on realm.
Below exception is most frequently occurred one (collected from GooglePlayDeveloper Console) The 99.8% of this exception came from Android 4.4 device and one forth came from LG G3. (FYI. We do not encrypt the Realm.)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/ks01lteskt/ks01lteskt:4.4.2/KOT49H/E330SKSUCNJ1:user/release-keys'
Revision: '13'
pid: 14636, tid: 14756, name: db_thead >>> kr.co.vcnc.android.couple <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr fffffffc
r0 7b7395e0 r1 ffffffff r2 7b7395e0 r3 00000000
r4 7b7395e0 r5 7caf9708 r6 73a03f80 r7 ffffffff
r8 7b739148 r9 00020590 sl 7c91cad8 fp 798fe960
ip 00000001 sp 7c91be98 lr 7ca6f31d pc 7ca72c6e cpsr 60070030
d0 0000000000000000 d1 0000000000000000
d2 0000000000000000 d3 0000000000000000
d4 0037003a00220066 d5 007d0030002e0034
d6 006500770022002c d7 0065006800740061
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 6d9dc0b86d9dc080 d17 6d9dc1286d9dc0f0
d18 6d9dc1986d9dc160 d19 6d9dc2086d9dc1d0
d20 6d9dc2786d9dc240 d21 6de4c5806d9dc2b0
d22 6de4c3486de4c5b8 d23 6de4c3b86de4c380
d24 4008000000000000 d25 3ff0000000000000
d26 3c4baf4e740749c8 d27 3fa7b80000000000
d28 bf5224a5191957e0 d29 3f6293aba995d593
d30 be63c064abe8bbf2 d31 3f11562ac78a4541
scr 60000012
backtrace:
#00 pc 00057c6e /data/app-lib/kr.co.vcnc.android.couple-2/librealm-jni.so
#01 pc 00054319 /data/app-lib/kr.co.vcnc.android.couple-2/librealm-jni.so
code around pc:
7ca72c4c 46022300 f0324630 e7eefef5 6089f504
7ca72c5c f7f74629 4620fc4f f7ff2100 f8d4fc8f
7ca72c6c f8533448 e8bd0027 e92d87f0 b0954ff0
7ca72c7c 46064691 451ee9dd f7ff468b 4649ffbf
7ca72c8c 4622462b f9baf01e f8d36af3 f1b88008
7ca72c9c d03a0f00 0a04f108 af0a4631 f7f34650
7ca72cac f8d6f9d9 e9cde000 ae04450c e028f8cd
7ca72cbc f8cdcf0f c60fb028 0003e897 0003e886
7ca72ccc 4506e9cd f8cdad02 ac0c9008 c40fcd0f
7ca72cdc 000fe895 000fe884 46502129 fba9f007
7ca72cec 1c43a914 3d4cf841 7003230f 9102980a
7ca72cfc fda7f7f3 9902980c fda3f7f3 a902a80e
7ca72d0c fda8f7f3 f8c89b01 b0153008 8ff0e8bd
7ca72d1c 43f7e92d 460f4604 46162101 f7ef4698
7ca72d2c 4639fafb f7ff4620 f8d8ff69 46312000
7ca72d3c f7e617d3 6ae3f967 b1f5689d 0904f105
code around lr:
7ca6f2fc f7f341f0 e92db811 461741f3 4680461c
7ca6f30c fc7cf003 ac014621 46384606 fc76f003
7ca6f31c 46054639 f0194620 4621fdbf 0010f106
7ca6f32c fa1df024 f0224620 4620fff4 61754641
7ca6f33c fdb2f019 f1054621 f0240014 4620fa10
7ca6f34c ffe7f022 b00261ae 81f0e8bd 4615b5f0
7ca6f35c e000f8d0 6846460f cd0fb087 c40f466c
7ca6f36c e8954632 466b0003 0003e884 46394670
7ca6f37c f976f7fd bdf0b007 41f0e92d 8b02ed2d
7ca6f38c 8b40eeb0 4604b084 2101460f f7f24616
7ca6f39c 4639ffc3 f0034620 4631fc31 0b48eeb0
7ca6f3ac fd12f029 689d6ae3 f105b315 46210804
7ca6f3bc 4640ac04 fe4ef7f6 4640211f f839f00b
7ca6f3cc f8441c43 23083d0c 70034621 f7f74638
7ca6f3dc 4630fa38 f7f74621 ab04fa34 ed239a01
7ca6f3ec cb038b02 f8423208 f8420c08 60aa1c04
Hi @hohnamkung Thanks for reporting this. Unfortunately there is not much to work with from this stack trace. Is it something you have been able to reproduce or have more info about? e.g in what sections of the code is it crashing?
I tried to reproduce it, but i couldn't. But some users have reported about a crash and i found that log on Google Play Console.
They said that crash still occurs after they reboot their device and crash happen when they start application. (when application start, we query data from the Realm.)
And according to Google Play Console, this exception was tracked Realm 0.82.2
So their apps no longer work? Are you able to get a copy of a Realm file from one of those users that we can look closer at?
Sorry for late reply.
I think that it takes some time to get a realm file from user. (If user went through this exception, they usually remove application.)
I'm going to upgrade realm version to 0.85.1 in next week. I'll post that whether this exception fixed or not with some information.
Thanks.
@hohnamkung Thanks!
Hi all! We've updated new version using Realm 0.86.0 a few days ago, and this exception still exist. But after update (2 days ago), only 2 person report it.
Below traces is one of them.
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'lge/b1_skt_kr/b1:4.4.2/KOT49I.F350S10r/F350S10r.1442966531:user/release-keys'
Revision: '10'
pid: 19965, tid: 20120, name: db_thead >>> kr.co.vcnc.android.couple <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
r0 79204578 r1 00000000 r2 792037e8 r3 00000000
r4 79204578 r5 792037e8 r6 7b7f7008 r7 00000000
r8 00000000 r9 79204578 sl 0000000d fp 00000000
ip 00000001 sp 7b6de998 lr 7b76e823 pc 7b76e2b8 cpsr 200e0030
d0 0000000000000000 d1 0000000000000000
d2 0000000000000000 d3 0000000000000000
d4 000000ff3f800000 d5 437f0000437f0000
d6 000000ff3f800000 d7 437f0000000000ff
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 0000000200000002 d17 00000000429d7d58
d18 6d6be1986d6f4128 d19 6d6f41d06d6be1d0
d20 6d6be2786d6be240 d21 6d6f40106d6be2b0
d22 6d6f40f06d6f4048 d23 6d6f41986d6f4160
d24 3f8fcf32d797aef0 d25 0002aaa80002aaa8
d26 0000000000000000 d27 0000000400000004
d28 0000000000000000 d29 0000000000000000
d30 0000000400000004 d31 0000000400000004
scr 60000012
backtrace:
#00 pc 0008e2b8 /data/app-lib/kr.co.vcnc.android.couple-2/librealm-jni.so
#01 pc 0008e81f /data/app-lib/kr.co.vcnc.android.couple-2/librealm-jni.so
code around pc:
7b76e298 46284602 f8abf7d2 f504e7e5 46517014
7b76e2a8 fb80f7ca 21004620 fc4ef7ff 3250f8d4
7b76e2b8 0027f853 8ff8e8bd 1d06b570 460d4604
7b76e2c8 f7d34630 2300fe73 30b4f8c4 63251c6b
7b76e2d8 6960d00d b1536e03 f7ff4629 6803ffab
7b76e2e8 47986c5b e8bd4631 f01e4070 bd70beb3
7b76e2f8 e92d6803 b0894ff0 4606695b 46044798
7b76e308 d15b2800 b1b76a77 af041d35 f7d34628
7b76e318 6a70fe4d 68db6803 42844798 4622d241
7b76e328 6a714638 f7c93401 4628f857 23009a05
7b76e338 ffb6f7f2 6973e7ed d0482b00 1c4b6b31
7b76e348 69b3d141 f0402b00 e0408081 69b46970
7b76e358 f8d66a35 f7bbb01c 465afe6f f1044601
7b76e368 f7bc0098 f8d4f8b9 46293250 b020f853
7b76e378 000cf10b fdd6f7c8 23002201 400b4002
7b76e388 ea52460d 46860103 d07f4604 ea4f086d
code around lr:
7b76e800 f7ff9b02 2301fe5b 3070f885 b0044620
7b76e810 e92dbd70 461743f7 4688461c f7ff4681
7b76e820 4621fd0d 4606ac01 f7ff4638 4639fd07
7b76e830 46204605 ff00f78f f1064621 f7e90018
7b76e840 4620f925 fdc4f7e8 46494620 f78f61f5
7b76e850 4621fef3 0014f105 f918f7e9 f7e84620
7b76e860 61aefdb7 801cf8c5 e8bdb003 e92d83f0
7b76e870 f10241f3 9f080124 f78f4605 ae01fee5
7b76e880 68bb2400 38fff103 da134544 682868fb
7b76e890 1034f853 f7ff3401 4603fcd1 69994630
7b76e8a0 fecaf78f 46284631 f8f0f7e9 f7e84630
7b76e8b0 e7e9fd8f b0024628 81f0e8bd e92db082
7b76e8c0 b08943f0 4604461f 460d9311 3088f8d0
7b76e8d0 f8dd4616 b96b9048 f03b2008 4a43fc55
7b76e8e0 447a4943 44793208 22106002 4a416042
7b76e8f0 e00f447a 429a6803 2008d30e fc44f03b

@hohnamkung So it only happens on Android 4.4?
Yes. I think so.

@hohnamkung Do you have a java backtrace? Any more information you can get from your crash log backend? The crash become a bit different now, code 1 (SEGV_MAPERR), fault addr 00000000 seems like a null pointer in the native code.
Sorry, i don't have any java backtrace. I got these back traces from Google Play Console, it give me a only this kind crash log.
I've look through a exceptions came from latest version (using Realm v0.86.0), and there are 6 kinds of exception (it can be more than that, i've only looked last 2 days crash)
I attached log file. I hope it'll be helpful.
@hohnamkung
I just checked the log, some more questions:
- Do you use encryption?
- Do you have multi process to access the same Realm file?
- I saw it always crashes on
db_thread, what does this thread do?
@beeender
- I don't use encryption yet. (I'm going to encrypt but not yet)
- No, This application does not declare any process in AndroidManifest. I think in that case it's a single process.
db_threadis aHandlerThreadfor realm query. RealmQuery is usually executed on this thread.
if (DB_THREAD_SCHEDULER == null) {
HandlerThread dbHandlerThread = new HandlerThread("db_thead");
dbHandlerThread.start();
Handler dbHandler = new Handler(dbHandlerThread.getLooper());
DB_THREAD_SCHEDULER = AndroidSchedulers.handlerThread(dbHandler);
}
return DB_THREAD_SCHEDULER;
@hohnamkung Is it possible to share the db_thread related source code with us privately? to [email protected]
Or please explain a bit how do you run the query in that thread and how do you pass the query result to other threads. Thanks!
Yes. I'll post or share related code snippet with some explanation tomorrow.
I'm using realm with rx. Using apt, i automatically create RealmObservables look like this.
public static Observable<Iterable<CHomeCardViewView>> resultStream(Context context, final Func1<Realm, RealmResults<RHomeCardViewView>> function) {
return Observable.create(new OnSubscribeRealmChange<RHomeCardViewView, CHomeCardViewView>(context) {
@Override
public RealmResults<RHomeCardViewView> get(Realm realm) {
return function.call(realm);
}
@Override
public Iterable<CHomeCardViewView> convert(RealmResults<RHomeCardViewView> realmResults) {
return fj.data.List.iterableList(realmResults).map(new F<RHomeCardViewView, CHomeCardViewView>() {
@Override
public CHomeCardViewView f(RHomeCardViewView r) {
return r.toCObject(r);
}
});
}});
}
I make RealmObservable using RealmChangeListener.
public abstract class OnSubscribeRealmChange<R extends RealmObject, D> implements Observable.OnSubscribe<Iterable<D>> {
private Context context;
public OnSubscribeRealmChange(Context context) {
this.context = context;
}
@Override
public void call(final Subscriber<? super Iterable<D>> subscriber) {
Realm realm = Realm.getDefaultInstance();
final RealmChangeListener listener = () -> query(subscriber);
subscriber.add(Subscriptions.create(() -> {
Observable.create(new Observable.OnSubscribe<Boolean>() {
@Override
public void call(Subscriber<? super Boolean> subscriber) {
realm.removeChangeListener(listener);
subscriber.onNext(Boolean.TRUE);
subscriber.onCompleted();
}
}).subscribeOn(CSchedulers.dbThread());
}));
realm.addChangeListener(listener);
query(subscriber);
}
fj.data.List<D> data = null;
private void query(Subscriber<? super Iterable<D>> subscriber) {
final Realm realm = Realm.getDefaultInstance();
try {
Iterable<D> result = convert(get(realm));
if (!result.equals(data)) {
data = (List<D>) result;
subscriber.onNext(result);
}
} catch (RuntimeException e) {
subscriber.onError(new RealmException("Error during transaction.", e));
} catch (Error e) {
subscriber.onError(e);
}
realm.close();
}
public abstract RealmResults<R> get(Realm realm);
public abstract Iterable<D> convert(RealmResults<R> realmResults);
}
Then, i covert DAO to POJO using toCObject (Automatically created by APT).
This method is called in public abstract Iterable<D> convert(RealmResults<R> realmResults);
RAnniversaryViewObservable.resultStream(coupleActivity, realm -> realm.where(RAnniversaryView.class).findAll())
.subscribeOn(CSchedulers.dbThread())
.subscribe(...)
Update: It happens on specific devices: Mostly on LG G3, G Pro.
Xperia Z1(C6903) 2 0.2% Xperia Z1(C6902) 2 0.2% Xperia Z3(SOL26) 42 4.6% Xperia Z Ultra(SOL24) 6 0.7% Xperia ZL2(SOL25) 6 0.7% Xperia Z1(SOL23) 15 1.6% Galaxy Note3 Neo(frescoltektt) 11 1.2% G Pro2(b1) 233 25.5% Galaxy Note3 Neo(frescolteskt) 12 1.3% Galaxy Grand2(ms01lteskt) 2 0.2% Galaxy Grand2(ms01ltektt) 1 0.1% Galaxy S4(ks01ltektt) 9 1.0% Galaxy S5(kltektt) 1 0.1% Xperia Z(C6602) 1 0.1% Xperia Z(C6603) 1 0.1% Galaxy S5(klteskt) 3 0.3% Galaxy S5(kltetmo) 2 0.2% Galaxy Note3 Neo(frescoltelgt) 8 0.9% Galaxy S4 LTE-A(ks01lteskt) 52 5.7% Xperia Z1(SO-01F) 13 1.4% Xperia Z3(SO-01G) 34 3.7% Galaxy S5(lentisltelgt) 6 0.7% Galaxy Grand2(ms01ltelgt) 4 0.4% MI 3W(cancro) 14 1.5% Galaxy S3 Neo(s3ve3gdd) 1 0.1% Xperia Z3(D6653) 1 0.1% F-01F(F01F) 2 0.2% Xperia Z (SO-02E) 12 1.3% Xperia Z1f(SO-02F) 20 2.2% Xperia Z3 Compact(SO-02G) 39 4.3% Galaxy S5(SCL23) 1 0.1% Galaxy Grand2(ms013g) 2 0.2% Galaxy S4(ks01ltelgt) 1 0.1% Galaxy S5(kltelgt) 1 0.1% Galaxy S5(klte) 2 0.2% SC-04F(SC-04F) 1 0.1% Xperia Z3(401SO) 8 0.9% Xperia Z2(SO-03F) 27 3.0% Galaxy S5(lentislteskt) 17 1.9% LG G3(g3) 278 30.4% Xperia J1 Compact(D5788) 3 0.3% Galaxy Tab4 8.0(milletltelgt) 1 0.1% Xperia A2(SO-04F) 5 0.5% Galaxy S4 Active(jactivelteskt) 9 1.0% Galaxy S3 Neo Plus(s3ve3g) 1 0.1% MI NOTE LTE(virgo) 1 0.1% F-05F(F05F) 1 0.1%
Hi @swkimme Without any sort of stack trace we are pretty much shooting the dark here unfortunately. We are continuously adding more checks in the Java code / Core layer, so I would definitely advice you to upgrade to the latest release (0.87.2)
Do you have any contact with users that can reproduce this or is it just happening sporadically? Also any indication of what code you are executing when it crashes would be nice.
Note if you are able to reproduce this you can call io.realm.internal.Util.setDebugLevel(2) to get quite accurate information about what methods are being called in Realms JNI layer, which can be helpful when finding the root cause for this.
I talked to @swkimme and updating current status
- he will update Realm to 0.87.2 (currently, using 0.87.1) and see it makes better.
- Unfortunately, he doesn't have contact of users and this is not reproducible.
For now there isn't much we can do other than update and see how it goes better or not.
Hi guys, here's some additional information.
Our team have been through our bug tracking system, and found a realm bug seems quite similar to this issue in some points.
The bug only occurs on Android 4, and mostly on LG devices. It's quite similar environment with this issue.
Stack traces are below.
Non-fatal Exception: java.lang.RuntimeException re-throw on exception class missing constructor raw
io.realm.internal.UncheckedRow.nativeGetString (UncheckedRow.java) io.realm.internal.UncheckedRow.getString (UncheckedRow.java:169) io.realm.RImageRealmProxy.getSource (RImageRealmProxy.java:89) kr.co.vcnc.android.couple.between.api.model.attachment.RImage.toCObject (RImage.java:53) kr.co.vcnc.android.couple.between.api.model.homecard.RHomeImageFile.toCObject (RHomeImageFile.java:79) kr.co.vcnc.android.couple.between.api.model.homecard.RBetweenDateCategory.toCObject (RBetweenDateCategory.java:44) kr.co.vcnc.android.couple.between.api.model.homecard.RLocationBasedBetweenDateCardElement.toCObject (RLocationBasedBetweenDateCardElement.java:162) kr.co.vcnc.android.couple.between.api.model.homecard.RLocationBasedBetweenDateCardView.toCObject (RLocationBasedBetweenDateCardView.java:42) kr.co.vcnc.android.couple.between.api.model.homecard.RHomeCardView.toCObject (RHomeCardView.java:234) kr.co.vcnc.android.couple.model.viewmodel.RHomeCardViewView.toCObject (RHomeCardViewView.java:83) kr.co.vcnc.android.couple.feature.home.HomeController$2$$Lambda$2.call (Unknown Source)
I'm not sure that the bug is related to this issue, but at least I guess it's good to be looking into it.
Thanks!