Crash on 2database access with encryption enabled
Taking my comment from #810 and making it its own issue -
On one of my test devices, running realm with encryption enabled produces a SIGSERV in libc. The line causing the crash is validateMethod = generatedClass.getMethod("validateTable", new Class[]{ImplicitTransaction.class});, in initializeRealm in Realm.java (line 606 in 0.79.1). Notably the crash is not happening on the first initializeRealm is called, only on any subsequent time.
The device with the issue is a Droid X running Android 4.4.4 - notable in that it is a Low Ram device. The issue does not happen if encryption is disabled (so I've only tested its presence on 0.78 and 0.79.1).
Thank you! We will try to replicate the error.
Hi @iflatness We just released 0.80.0 with some fixes for encrypted Realms. Can you you try to upgrade to see if you can still reproduce this issue?
Upgrading to 0.80.0 the one device still crashes on the same line.
Hi @iflatness Are you able to provide some more detailed logcat output, so we have better idea what is causing the crash. If you are able to make it crash in a sample project, it would also help immensely?
Alright, I made a simple app that throws the crash(es?). Hope it helps https://github.com/iflatness/realm898
Hi @iflatness Sorry for the late reply. Thank you very much for the test project. Unfortunately I cannot get it to crash, but that might be because the emulator low-ram settings are different from an actual device.
Can you provide a bit more details about your device?
- Is it a Motorola Droid X? http://www.gsmarena.com/motorola_droid_x-3473.php
- If it is, it shouldn't be able to run KitKat (which provide the Low-Ram configuration options), unless it is a rooted device running some fork like Cyanogen. Is that the case?
@cmelchior Yes, it is a Motorola Droid X, and is running Cyanogen to get KitKat. (We did this in order to have a physical device running low-ram) I tried fiddling around with the test project. I also cannot get it to crash on an emulated lowram device. In my fiddling however my error was switched to a RealmMigrationNeededException, which is thrown under the same circumstances even when there was no existing database. The error log for that is below, and the issue still seems to be based in columnIndex > available columns.
io.realm.exceptions.RealmMigrationNeededException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2212)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
Caused by: io.realm.exceptions.RealmMigrationNeededException
at io.realm.Realm.initializeRealm(Realm.java:631)
at io.realm.Realm.createAndValidate(Realm.java:531)
at io.realm.Realm.create(Realm.java:486)
at io.realm.Realm.getInstance(Realm.java:459)
at com.iflatness.realm898.OpeningPage.onCreate(OpeningPage.java:77)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at io.realm.Realm.initializeRealm(Realm.java:627)
at io.realm.Realm.createAndValidate(Realm.java:531)
at io.realm.Realm.create(Realm.java:486)
at io.realm.Realm.getInstance(Realm.java:459)
at com.iflatness.realm898.OpeningPage.onCreate(OpeningPage.java:77)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
Caused by: java.lang.IllegalStateException: Column count does not match
at io.realm.Model2RealmProxy.validateTable(Model2RealmProxy.java:290)
at java.lang.reflect.Method.invoke(Native Method)
at io.realm.Realm.initializeRealm(Realm.java:627)
at io.realm.Realm.createAndValidate(Realm.java:531)
at io.realm.Realm.create(Realm.java:486)
at io.realm.Realm.getInstance(Realm.java:459)
at com.iflatness.realm898.OpeningPage.onCreate(OpeningPage.java:77)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5179)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
We haven't been able to find a low-mem device yet which means that we haven't had a chance to reproduce it. We'll keep searching.
We have order a low-mem device, and we hope to have it at the office on 2-3 weeks.
I have finally got hold on a lowmen device, and I can reproduce the issue - even on our current master. @iflatness, the device you are testing on, is the /data partition encrypted?
@iflatness We have a few updates for encryption coming up - see #1430.
We did a release recently to fix some encryption issues. @iflatness, did you have a chance to try this?
Sorry for not responding earlier, but I no longer have access to the lowram device and cannot test. However I don't believe the /data partition was encrypted.
On Sep 9, 2015, at 04:15, Kenneth Geisshirt [email protected] wrote:
We did a release recently to fix some encryption issues. @iflatness, did you have a chance to try this?
— Reply to this email directly or view it on GitHub.
@iflatness The hypothesis of encrypted /data partition was one of many early hypothesis. Others seem correct, and we did some bug fixes from those.