realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 6777 #3765

Closed matomick closed 7 years ago

matomick commented 7 years ago

I get this crash with some devices (Honor7, Xiaomi MI5, etc...), it seems like the realm database is corrupted, but it never happens with precedent realm versions. (current version: 2.1.1)

The crash appears on Realm.getInstance(conf) Any ideas?

my realmConfig: realmFileName = Realm.DEFAULT_REALM_NAME; config = new RealmConfiguration.Builder() .name(realmFileName) .schemaVersion(versionSchema) .encryptionKey(keykey) .migration(new MigrationRealm()) .build();

logs: A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x28 in tid 6777 (cetts.messaging) Build fingerprint: 'Xiaomi/gemini/gemini:6.0/MRA58K/V7.2.8.0.MAACNDB:user/release-keys' pid: 6777, tid: 6777, name: cetts.messaging >>> com.facetts.messaging <<< signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x28 sp 0000007fd4d0ae40 pc 0000007fab9653cc pstate 0000000060000000 backtrace:

00 pc 00000000001523cc /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so

 #01 pc 000000000016593c  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #02 pc 0000000000124918  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #03 pc 00000000001659bc  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #05 pc 00000000000a1a24  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #06 pc 00000000000a8bf8  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #07 pc 00000000000bb750  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #08 pc 00000000000bf420  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #09 pc 00000000000b85dc  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so
 #10 pc 000000000004a788  /data/app/com.facetts.messaging-2/lib/arm64/librealm-jni.so (Java_io_realm_internal_SharedRealm_nativeGetSharedRealm+304)
 #11 pc 00000000013f56fc  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (long io.realm.internal.SharedRealm.nativeGetSharedRealm(long, io.realm.internal.RealmNotifier)+160)
 #12 pc 00000000013f46e4  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (io.realm.internal.SharedRealm io.realm.internal.SharedRealm.getInstance(io.realm.RealmConfiguration, io.realm.internal.RealmNotifier, io.realm.internal.SharedRealm$SchemaVersionListener)+760)
 #13 pc 00000000013f43a4  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (io.realm.internal.SharedRealm io.realm.internal.SharedRealm.getInstance(io.realm.RealmConfiguration)+72)
 #14 pc 00000000013c13cc  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (io.realm.BaseRealm io.realm.RealmCache.createRealmOrGetFromCache(io.realm.RealmConfiguration, java.lang.Class)+656)
 #15 pc 0000000001a498c4  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (io.realm.Realm io.realm.Realm.getInstance(io.realm.RealmConfiguration)+232)
 #16 pc 000000000117e828  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (io.realm.Realm com.valrsoft.facetts.controller.DataAccess.getRealmInstance()+2876)
 #17 pc 000000000112dfb4  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.common.GarbageCollectorFacetts.facettsRecycle()+88)
 #18 pc 0000000001130e70  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.common.GarbageCollectorFacetts.recycle()+68)
 #19 pc 0000000001144fc0  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.common.cache.CacheData.<init>(java.lang.String, java.lang.String, com.valrsoft.facetts.controller.DataAccess, android.content.Context)+17188)
 #20 pc 000000000114aad8  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.common.cache.ImageStore.<init>(java.lang.String, java.lang.String, com.valrsoft.facetts.controller.DataAccess, android.content.Context)+380)
 #21 pc 00000000011c715c  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.controller.FlowControler.init(android.content.Context)+3072)
 #22 pc 0000000001234c58  /data/app/com.facetts.messaging-2/oat/arm64/base.odex (offset 0xbde000) (void com.valrsoft.facetts.ui.SplashScreenActivity.onCreate(android.os.Bundle)+3452)
 #23 pc 0000000073ee0b70  /data/dalvik-cache/arm64/system@framework@boot.oat (offset 0x238a000)
kneth commented 7 years ago

How easy is it to reproduce? Does it happens every time?

Does it happens the first time, the app is opened?

matomick commented 7 years ago

The database was allready created since a while, for my case I was using my app for 3 month. It seems to be very rare. But the app crash without any exceptions, so I don't have any reports if it.

I think it could be an issue with the MIUI or EMUI android app killer (energy saver). If there is a transaction, and the app is killed during the commit, maybe it could corrupt the database? Like with a non encrypted database, just the data of this transaction is corrupted, but with an encrypted database, all the database is corrupted...

kneth commented 7 years ago

@matomick Thanks for providing a hypothesis. Without reproduction, I can only comment in general terms. Realm should not corrupt a database if the app is kill during a transaction.

cmelchior commented 7 years ago

Hi @matomick Without further information there is not much we can do about this. I'll close it for now, but feel free to reopen if more information about reproducing this surfaces.

timmygap commented 7 years ago

I had the same issue, but I don't got more Informationen than @matomick posted. I used my app and write 5-10minutes and than the app crashed. After this I can´t start the app again. It Looks like that the database is corrupted. @kneth

Zhuinden commented 7 years ago

@tkrawetzke is the version 2.x+?

timmygap commented 7 years ago

2.1.1 and after updating to 2.2.0 the issue isn't resolved too.

timmygap commented 7 years ago

For me the init isn't the Problem. Realm.init(context) (works) RealmConfiguration.Builder().schemaVersion(10).migration(DatabaseMigration(context)).build() (works) Realm.setDefaultConfiguration(configuration) (works) Realm.getDefaultInstance() (crashed)

It looks like if I read or write on realm the app crashed.

timmygap commented 7 years ago

Currently we have solved the problem by downgrade the realm version to v2.0.2

More Information that we got: We use a sync adapter and if we got much data the realm crashed while we update data after syncing it. But in v2.0.2 we can´t repro it at the moment.