realm-java: RealmError: Incompatible lock file / After 2.0 RealmFileException All processes sharing a single file must be the same architecture.
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.
The peak point is yesterday. (Realm v0.88.0)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 141 (64 by maintainers)
Commits related to this issue
- Optimistic opening of a Realm file (#3013) We have anecdotal evidence that multiple processes might be open for the same app. We have not been able to verify this, but the result matches the "Incompa... — committed to realm/realm-java by cmelchior 8 years ago
- Adding test for reproducing github issue #2459 — committed to realm/realm-java by deleted user 8 years ago
- Update sync to 2.1.4 Close #2459 — committed to realm/realm-java by beeender 7 years ago
- Update sync to 2.1.4 Close #2459 — committed to realm/realm-java by beeender 7 years ago
@beeender He said he opened the app and leave it a while(and the device went to sleep), and the next time he took the phone the error occurred after some scroll or click.
no
as far as I can see from merged AndroidManifest, our app does not have other processes.
I don’t think so. We had armeabi excluded in Realm 1.x.
And there wasn’t any problems on these devices.
@cmelchior Thanks for the response. As you suggested I’ve created a new issue: https://github.com/realm/realm-java/issues/7144. @mirceasotan please add any additional information to the new ticket if you can.
we have a potential fix for this issue which will be released in
4.2.0
. See https://github.com/realm/realm-core/pull/2902 about the explanation about the fix.@jangc You need to use java’s exposed flock system api to implement you own process lock safety checks. We have seen alarm intents sent by android on some older android to be processed in different processes despite multiProcess feature disabled in manifest. You need to detect this and ignore what operations you are doing if you can’t acquire a flock.
@PiotrWpl Firebase opens a second process for itself, so if you open Realm using
Realm.getDefaultInstance()
inCustomApplication.onCreate()
, then this can happen.I’ve been thinking that such initialization logic should be moved to a
BaseActivity
instead.Any minute now 😉
@hohnamkung has confirmed that @beeender’s workaround works well.