realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

RealmError: Incompatible lock file / After 2.0 RealmFileException All processes sharing a single file must be the same architecture.

Open hohnamkung opened this issue 10 years ago • 141 comments

Goal

To report specific error after upgrading v0.88.0

Expected Results

Crash is not occurred.

Actual Results

Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file in io_realm_internal_SharedGroup.cpp line 113
   at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
   at io.realm.internal.SharedGroup.(SharedGroup.java:63)
   at io.realm.internal.SharedGroupManager.(SharedGroupManager.java:48)
   at io.realm.BaseRealm.(BaseRealm.java:76)
   at io.realm.Realm.(Realm.java:138)
   at io.realm.Realm.createAndValidate(Realm.java:268)
   at io.realm.Realm.createInstance(Realm.java:248)
   at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114)
   at io.realm.Realm.getInstance(Realm.java:213)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.updateHomeBadge(MainTabIndicator.java:138)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.onAttachedToWindow(MainTabIndicator.java:83)
   at android.view.View.dispatchAttachedToWindow(View.java:12626)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2473)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1264)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1047)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5896)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
   at android.view.Choreographer.doFrame(Choreographer.java:544)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5120)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:792)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
   at dalvik.system.NativeStart.main(NativeStart.java)

Steps & Code to Reproduce

I got this stack trace from Fabric. I've tested several devices that we have, i can't reproduce it. Instead, i attached some code that error is happening.

FYI, at this update (to v0.88.0), we upgraded Realm's schema version. (We're using deleteRealmIfMigrationNeeded option)

Code Sample

@Override
protected void onAttachedToWindow() {
    homeBadgeSubscription = Realm.getInstance(CoupleApplication.getRealmHome())
                .where(RHomeCardViewView.class)
                .equalTo("closed", false)
                .equalTo("newIndicator", true)
                .findAllAsync()
                .asObservable()
                .filter(RealmResults::isLoaded)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(BasicSubscriber.    <RealmResults<RHomeCardViewView>>create().next(homeCardViewViews -> {
                    int size = homeCardViewViews.size();
                    updateTextView(size);
                }));

@Override
protected void onDetachedFromWindow() {
    if (homeBadgeSubscription != null) {
        homeBadgeSubscription.unsubscribe();
    }
}

Version of Realm and tooling

Realm version(s): v0.88.0

Which Android version and device: When i first saw this crash, i think this is occurred because users are using BlackBerry. But now Android users have a crash.

screen shot 2016-03-15 at 10 55 28 am screen shot 2016-03-15 at 10 55 40 am screen shot 2016-03-15 at 10 55 47 am

The peak point is yesterday. (Realm v0.88.0) screen shot 2016-03-15 at 10 59 39 am

hohnamkung avatar Mar 15 '16 02:03 hohnamkung

@hohnamkung

  1. Can you share the latest apk with us? to [email protected]
  2. Are you using Realm in different processes? eg. Some services are running in a different process and accessing the same Realm which is used in the main activity as well.

beeender avatar Mar 15 '16 02:03 beeender

Is it the first time when the getInstance() gets called in the app?

beeender avatar Mar 15 '16 03:03 beeender

Yes. I've just tested. Realm.getInstance(CoupleApplication.getRealmHome()) is first invoked at that point.

We're using single process (don't declare any process in AndroidManifest.xml) In AppWidgetProvider we query realm (same configuration, CoupleApplication.getRealmHome), but i think that that code run on same process. (http://stackoverflow.com/a/11017453/4444109)

hohnamkung avatar Mar 15 '16 03:03 hohnamkung

@hohnamkung Two more questions:

  1. Do you have any more information about how many crashed devices are 64bit?
  2. Do you ship the Realm's arm64 so with the apk?

beeender avatar Mar 15 '16 09:03 beeender

APK at https://secure.helpscout.net/conversation/181563825/3381/?folderId=366141

beeender avatar Mar 15 '16 15:03 beeender

  1. I'm not sure how many it is, but top 3 devices in Samsung and LG are 32bit OS screen shot 2016-03-16 at 10 28 31 am

  2. No. I excluded it on purpose to prevent some device from can't load so file exception.

    packagingOptions {
        // Workaround for failing to fall back to choose a non-64bit version of so
        exclude "lib/arm64-v8a/librealm-jni.so"
        exclude "lib/x86_64/librealm-jni.so"
    }
    

hohnamkung avatar Mar 16 '16 01:03 hohnamkung

@hohnamkung We just released 0.88.2, it has a potential fix of this problem (which i am not sure could solve this, but worth a try), and some more information about the exception is added to help us debug if it still happens. And it also has a fix for the bad version problem you have.

Would you please give it a try? And let us know if this problem is still there. thanks a lot, and sorry for those troubles.

beeender avatar Mar 16 '16 02:03 beeender

@beeender I'll release new version using 0.88.2 sooner than later! Thanks!

hohnamkung avatar Mar 16 '16 02:03 hohnamkung

Hi @beeender After update, i still have a problem (Exception log is a little changed)

Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Shared info version doesn't match, 4 5. in io_realm_internal_SharedGroup.cpp line 113
   at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
   at io.realm.internal.SharedGroup.(SharedGroup.java:64)
   at io.realm.internal.SharedGroupManager.(SharedGroupManager.java:49)
   at io.realm.BaseRealm.(BaseRealm.java:76)
   at io.realm.Realm.(Realm.java:138)
   at io.realm.Realm.createAndValidate(Realm.java:268)
   at io.realm.Realm.createInstance(Realm.java:248)
   at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114)
   at io.realm.Realm.getInstance(Realm.java:213)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.updateHomeBadge(MainTabIndicator.java:138)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.onAttachedToWindow(MainTabIndicator.java:83)
   at android.view.View.dispatchAttachedToWindow(View.java:12658)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2473)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2480)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1255)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1038)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5889)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
   at android.view.Choreographer.doFrame(Choreographer.java:544)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
   at android.os.Handler.handleCallback(Handler.java:733)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5118)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:610)
   at dalvik.system.NativeStart.main(NativeStart.java)

hohnamkung avatar Mar 17 '16 02:03 hohnamkung

Thanks a lot for the information, i will check and get back to you ASAP.

beeender avatar Mar 17 '16 02:03 beeender

And another crash log is collected. If you think that it's is a another problem, i'll make a other issue.

Fatal Exception: java.lang.IllegalArgumentException: Illegal Argument: Invalid format of Realm file.
   at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
   at io.realm.internal.SharedGroup.(SharedGroup.java)
   at io.realm.internal.SharedGroupManager.(SharedGroupManager.java)
   at io.realm.BaseRealm.(BaseRealm.java)
   at io.realm.Realm.(Realm.java)
   at io.realm.Realm.createAndValidate(Realm.java:268)
   at io.realm.Realm.createInstance(Realm.java:248)
   at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114)
   at io.realm.Realm.getInstance(Realm.java:213)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.updateHomeBadge(MainTabIndicator.java:138)
   at kr.co.vcnc.android.couple.feature.MainTabIndicator.onAttachedToWindow(MainTabIndicator.java:83)
   at android.view.View.dispatchAttachedToWindow(View.java:11888)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2521)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2528)
   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1207)
   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1006)
   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4225)
   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
   at android.view.Choreographer.doCallbacks(Choreographer.java:555)
   at android.view.Choreographer.doFrame(Choreographer.java:525)
   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
   at android.os.Handler.handleCallback(Handler.java:615)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:213)
   at android.app.ActivityThread.main(ActivityThread.java:4786)
   at java.lang.reflect.Method.invokeNative(Method.java)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
   at dalvik.system.NativeStart.main(NativeStart.java)

hohnamkung avatar Mar 17 '16 02:03 hohnamkung

Please create another issue for that, it seems to be another problem. Thanks!

beeender avatar Mar 17 '16 02:03 beeender

http://crashes.to/s/0762fe58804

dalinaum avatar Mar 18 '16 05:03 dalinaum

@hohnamkung has confirmed that @beeender's workaround works well.

dalinaum avatar Mar 29 '16 08:03 dalinaum

@dalinaum I have an app in play store [https://play.google.com/store/apps/details?id=com.isletsystems.android.cricitch.lite] that is growing steadily, and is experiencing the same error @hohnamkung detailed, in my most recent build that I published.

I had built the app with the following:

  • classpath 'io.realm:realm-gradle-plugin:0.88.2'
  • buildToolsVersion '24.0.0-rc2'
  • com.android.support:23.2.1

error from crashlytics: Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Shared info version doesn't match, 4 5. in io_realm_internal_SharedGroup.cpp line 113 at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java) at io.realm.internal.SharedGroup.(SharedGroup.java:64) at io.realm.internal.SharedGroupManager.(SharedGroupManager.java:49) at io.realm.BaseRealm.(BaseRealm.java:76) at io.realm.Realm.(Realm.java:138) at io.realm.Realm.createAndValidate(Realm.java:268) at io.realm.Realm.createInstance(Realm.java:248) at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:114) at io.realm.Realm.getInstance(Realm.java:213) at com.isletsystems.android.cricitch.app.CricitchApplication.onCreate(CricitchApplication.java:69) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4609) at android.app.ActivityThread.access$1600(ActivityThread.java:169) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1337) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5476) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099) at dalvik.system.NativeStart.main(NativeStart.java)

screen shot 2016-03-31 at 8 40 40 pm

Looking forward to a new release of realm java with a fix for the same.

appsailor avatar Mar 31 '16 07:03 appsailor

@appsailor Can you list those devices which have this problem? Maybe we are lucky enough to have one of them to reproduce the issue.

beeender avatar Mar 31 '16 07:03 beeender

@beeender here are those devices experiencing problems. screen shot 2016-04-01 at 3 43 55 am screen shot 2016-04-01 at 3 42 06 am screen shot 2016-04-01 at 3 40 42 am

appsailor avatar Mar 31 '16 14:03 appsailor

Any luck with this issue getting resolved? Thx in advance.

appsailor avatar Apr 11 '16 05:04 appsailor

@appsailor Sorry, but we still have no luck to reproduce the issue...

beeender avatar Apr 11 '16 07:04 beeender

@appsailor Sent a mail to you email address :)

beeender avatar Apr 11 '16 07:04 beeender