To report specific error after upgrading v0.88.0
Crash is not occurred.
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)
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)
@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();
}
}
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)
@hohnamkung
Is it the first time when the getInstance()
gets called in the app?
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 Two more questions:
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 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
I'll release new version using 0.88.2 sooner than later!
Thanks!
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)
Thanks a lot for the information, i will check and get back to you ASAP.
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)
Please create another issue for that, it seems to be another problem. Thanks!
@hohnamkung has confirmed that @beeender's workaround works well.
@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:
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)
Looking forward to a new release of realm java with a fix for the same.
@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 here are those devices experiencing problems.
Any luck with this issue getting resolved? Thx in advance.
@appsailor Sorry, but we still have no luck to reproduce the issue...
@appsailor Sent a mail to you email address :)
Same issue here with version 0.88.3. I'll update to 0.90.1 in the next app update.
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(SourceFile)
at io.realm.internal.SharedGroup.(SourceFile)
at io.realm.internal.SharedGroupManager.(SourceFile)
at io.realm.BaseRealm.(SourceFile)
at io.realm.Realm.(SourceFile)
at io.realm.Realm.createAndValidate(SourceFile:268)
at io.realm.Realm.createInstance(SourceFile:248)
at io.realm.RealmCache.createRealmOrGetFromCache(SourceFile:114)
at io.realm.Realm.getDefaultInstance(SourceFile:195)
at com.transpose.core.manager.FilesManager.checkFileUploadQueue(SourceFile:107)
at com.transpose.core.sync.TransposeSyncAdapter.onPerformSync(SourceFile:125)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:259)
Devices are:
Samsung t320 87%
Samsung n9005 7%
Samsung n915p 3%
Also Blackberry Z10 & Passport
Call to Realm.getDefaultInstance()
from above stacktrace is coming from SyncAdapter (another thread). Also it can be called from the UI thread.
Still get same error after upgrade realm to 0.91.0-SNAPSHOT, is it useful to delete realm file when I get this error?
@hufozhu If you use Realm as a cache, and you can reload data from other sources, you can delete the Realm file (which will also remove the lock files).
@kneth Thanks for quick reply. What I really want to know is whether this error only occurs when there is a old realm file. Our app gets this error from about 0.5% of our users, and since 0.91.0-SNAPSHOT does not resolve this error, I want to delete old realm for this 0.5% users if it is useful. Thanks!
@hufozhu We haven't been able to reproduce the issue, so I can't really say if it is related to old Realm files only. It is an interesting observation, and it might give us a clue.
I don't know what kind of data your app's Realm files contain, and therefore I can't give you a definite advice on whether you can delete the files or not.
0.5 % sounds like a high number to me. Do you see any patterns in which devices with the issue? Can you reproduce the issue?
Is there a remote chance that you open a Realm in one thread and copying a Realm file from assets in another thread at the same time?
@kneth Thanks for reply. I decide to delete old file when app gets this error in our new version, hope it is helpful.
We release new version to about 2000 users and this error comes from 9 user. All 9 user use android 4.4 (the most popular version in China). I cannot reproduce it on all my devices. But next week we will release new version to public, after which millions of users will install new version, maybe I can provide more information for you.
We do not copy realm file from assets, but we do realm migration to two different realm file in two thread. Do you think this action maybe this reason?
No, migrating is in a sense nothing more than a special write transaction, and the two files are independent. My concern was that you copied a Realm file from the asset in one thread while executing a transaction in another. Overwriting an open file could give you weird errors.
Today, we have released a new version with a few fixes. We will be happy to hear from you if you see this issue when you have a larger user base. If you're based in China, I'm sure that @beeender will be happy to contact you.
@kneth I am sure that no copying of realm file happens in our project.
Happy to heard new version of realm is released, we may upgrade to new version with next release.
I will provide more information if the next week release still get this error, and I would appreciate that if @beeender can help us on this. Thanks again for your help. Good day!
We just upgraded from realm 0.87.3(ish) to 0.91.0. Had 1 crash due to this:
Device: Lenovo A5000 (4.4.2)
Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Info size doesn't match, 1112 1120. in io_realm_internal_SharedGroup.cpp line 113
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:64)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:64)
at io.realm.RealmConfiguration.getEncryptionKey(RealmConfiguration.java:124)
at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)
at io.realm.BaseRealm.<init>(BaseRealm.java:79)
at io.realm.Realm.<init>(Realm.java:138)
at io.realm.Realm.createAndValidate(Realm.java:248)
at io.realm.Realm.createInstance(Realm.java:228)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getInstance(Realm.java:192)
We have fixed subtle cases in 1.0.0 which could lead to the crash reported here. We will close the issue for now, but If you experience the issue again with our latest release, please open an issue.
@cmelchior when is the ETA for 1.0.0?
Any minute now ;)
@rimeissner I added 1.0.0 gradle plugin and it worked.
We're still having this issue, even though we've upgrade to 1.0.0.
Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Info size doesn't match, 1112 1120. in io_realm_internal_SharedGroup.cpp line 113
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
at io.realm.internal.SharedGroup.
at io.realm.internal.SharedGroupManager.
at io.realm.BaseRealm.
at io.realm.Realm.
at io.realm.Realm.createAndValidate(Realm.java:248)
at io.realm.Realm.createInstance(Realm.java:228)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getInstance(Realm.java:192)
Reopen since it is still happening. #2928
New crash from LenovoA3300-GV (4.4.2). But this time, we logged more info.
1) Crashed realm was first copied from as /assets folder to a r/w path to be later opened by realm and be update-able. The copy is performed right before the realm is opened and in the same thread.
2) Prior to copying, we removed all .lock/.log/.note files that might have lingered from previous.
3) Sometime prior to the crash, a realm migration was performed on a completely separate realm. The migration was as follows: a) create many new int.class columns. b) do transformation to copy/port String data into new int.class columns c) remove old String.class columns d) rename int.class columns to previously removed columns
4) The crashed device was previous on an app version with realm version < 0.91.0 (most likely 0.87.3) and just upgraded to app version with realm 1.0.0 and opening up the app for the first time presumably.
5) There is at least 1 and at most 2 realms open at the time of the crash.
That's all the info we have.
Caused by io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Info size doesn't match, 1112 1120. in io_realm_internal_SharedGroup.cpp line 113
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SharedGroup.java)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:64)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:64)
at io.realm.RealmConfiguration.getEncryptionKey(RealmConfiguration.java:126)
at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)
at io.realm.BaseRealm.<init>(BaseRealm.java:79)
at io.realm.Realm.<init>(Realm.java:138)
at io.realm.Realm.createAndValidate(Realm.java:248)
at io.realm.Realm.createInstance(Realm.java:228)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getInstance(Realm.java:192)
We're getting this too on our latest release, the first where we heavily use Realm. For about 0.5% of our users. Almost all Samsung. This release is using Realm 0.90.0.
We don't ever copy the DB file, but we do delete it in cases where it's not worth it to migrate. We also access the DB in a SyncAdapter that might be trying to run at application start when we're accomplishing Realm deletion/ recreation / migration.
Fatal Exception: io.realm.exceptions.RealmError: Unrecoverable error. Incompatible lock file. Info size doesn't match, 1112 1120. in io_realm_internal_SharedGroup.cpp line 113
at io.realm.internal.SharedGroup.createNativeWithImplicitTransactions(SourceFile)
at io.realm.internal.SharedGroup.(SourceFile:64)
at io.realm.internal.SharedGroupManager.(SourceFile:49)
at io.realm.BaseRealm.(SourceFile:77)
at io.realm.Realm.(SourceFile:138)
at io.realm.Realm.createAndValidate(SourceFile:269)
at io.realm.Realm.createInstance(SourceFile:249)
at io.realm.RealmCache.createRealmOrGetFromCache(SourceFile:118)
at io.realm.Realm.getDefaultInstance(SourceFile:195)
at com.genius.android.sync.GeniusRealmWrapper.(SourceFile:52)
at com.genius.android.sync.GeniusRealmWrapper.getDefaultInstance(SourceFile:67)
at com.genius.android.GeniusApplication.onCreate(SourceFile:53)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4747)
at android.app.ActivityThread.access$1500(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
@diegomontoya @lisawray @hohnamkung We are not seeing many reports for this error, but e.g @lisawray seems to have some users experience it more than once. Do you mind sending your AndroidManifest.xml
+ dependency list from build.gradle
to [email protected]. I am hoping that can help us find some common features between your apps that might give us a clue to what is causing this.
@cmelchior sent.
indeed ... we have some persistent users. that's like 10 crashes apiece. I haven't gotten a single personal report of this yet, so I don't know if it's crashing the app, but I assume so ...
Hi @lisawray and @hohnamkung Thanks for the files. I am going over them and you have a few commonalities I am looking into, unfortunately we have nothing concrete yet.
However after internal discussion and input from the outside I don't think we can rule out that two processes might be running during app upgrades which will manifest with the error described here. To prevent that we implemented a new scheme for opening Realm files which means it will retry optimistically for 3 seconds before finally giving up and crashing (like now). The PR is here #3013 and have been released as part of our 1.0.1 today.
For the happy path this doesn't have any effect, but if users encounter the error, the app will now appear frozen for up to 3 seconds before finally crashing like before or actually continuing.
If users encounter this error and our solution fixes it, a warning will be logged to LogCat.
1) If possible, can you try to upgrade to 1.0.1.
2) Our RealmLog
class takes a custom logger implementation so if you happen to use any sort of analytic tool. Please try to add a custom logger that tracks if such a warning is created. I will be happy to help you do this.
I'll keep this issue open until we are more why this issue is happening and what can be done to fix it.
One thing I just realised ist that we get Unrecoverable error. Incompatible lock file. Info size doesn't match, 1112 1120. in io_realm_internal_SharedGroup.cpp line 113
for an In-Memory realm on first initialisation of the app (in Applications onCreate).
@rimeissner If the root cause is what we expected (see https://github.com/realm/realm-java/issues/2459#issuecomment-226520214), the same root cause could be applied to the in-mem realm as well.
For a in-mem realm, it will also create a realm file underneath along with the lock files (kind of temporary files, but they are needed.). So if it is possible, please update to v1.0.1
to see if can solve the issue.
Ty @beeender We should be able to release a fix today, I will share the results
Hi Realm team. We are confronted with the same problem. Updating to v1.0.1 did not solve it.
@ToBoehmK Sorry to hear that. Can you provide more details? The best is if you have a project which can reproduce the crash. Otherwise, log files, tombstones or a link to crashlytics can also be helpful.
I'm having a similar issue. Just upgraded from 0.87 to 1.1.0 (with migrations).
This report also comes from fabric, devices:
Fatal Exception: io.realm.exceptions.RealmError: Could not open the Realm file: Incompatible lock file. Shared info version doesn't match, 4 7.
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:112)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:74)
at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)
at io.realm.BaseRealm.<init>(BaseRealm.java:81)
at io.realm.Realm.<init>(Realm.java:140)
at io.realm.Realm.createAndValidate(Realm.java:240)
at io.realm.Realm.createInstance(Realm.java:220)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getDefaultInstance(Realm.java:166)
at com.parafuzo.tasker.service.LoginService.currentTasker(LoginService.java:45)
at com.parafuzo.tasker.service.LoginService.isLoggedIn(LoginService.java:36)
at com.parafuzo.tasker.activity.LoginActivity.onCreate(LoginActivity.java:62)
at android.app.Activity.performCreate(Activity.java:5296)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2283)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2370)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5426)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
I've got two exceptions that are equal to the one listed above from an application in 1.1.0. We had no migration since its our first release with realm. They come from different points of the application, so it seems quite random, but I can't tell for sure.
Devices:
@ToBoehmK @jturolla @rodrigoolr How do your users upgrade the app? Through google play store? Or the app supports downloading & installing apk directly in the app?
@beeender We upgrade only through play store
Do you guys have any news on this issue? We have a couple of crashes on our latest versions due to this. Is there any information we could give that could help solving it?
Hi @rodrigoolr
Sorry for the late reply. Unfortunately no news yet.
A list of devices + android version would be greatly appreciated.
I have a wild guess that this only happens while you're updating from Google Play
@cmelchior I have around 400 crashes related to this in the last 30 days, and it doesn't really seem device or OS version specific, because the distribution is close to the app's...
I can try to log and track users that have just updated the app in the same session.
Is there I can workaround this issue for a while? Trying to instantiate again Realm again or something like that?
@Zhuinden I did lots of testing of that wild guess and can never reproduce it on any of my devices. Although I still think it is very possible the root cause.
Also, https://github.com/realm/realm-java/issues/1477#issuecomment-235178951 this seems to have the very similar root cause.
@rodrigoolr
Trying to instantiate again Realm again
We are already doing that (from 1.0.1), it will try multiple times in 3 secs. From the results we know, the problem is still happening. But we don't have enough valid data to say it doesn't work at all, or it makes it better.
If you want, you can tweak the retries time by following two static vars in your source code:
public class SharedGroup implements Closeable {
// Keep these public so we can ask users to experiment with these values if needed.
// Should be locked down as soon as possible.
public static long[] INCREMENTAL_BACKOFF_MS = new long[] {1, 10, 20, 50, 100, 200, 400}; // Will keep re-using last value until LIMIT is hit
public static long INCREMENTAL_BACKOFF_LIMIT_MS = 3000;
...
}
One question, does the crash rate gets better after more and more users updates to the new version?
@rodrigoolr Do you use firebase or any other libs could start a background process?
@beeender It has been getting a little better, we have a stable version running for 2-3 weeks now for all our users and it started with around 20-30 crashes a day on the first week and now it reached 10-20.
Yes, we currently use firebase
I also saw the following crash for a user:
Caused by: io.realm.exceptions.RealmError: Could not open the Realm file: Incompatible lock file. Shared info version doesn't match, 259 7.
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:112)
at io.realm.internal.SharedGroup.
at io.realm.internal.SharedGroupManager.
at io.realm.BaseRealm.
at io.realm.Realm.
at io.realm.Realm.createAndValidate(Realm.java:233)
at io.realm.Realm.createInstance(Realm.java:214)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getDefaultInstance(Realm.java:160)
Device: Galaxy S4 Mini (serranovelte) Samsung
Android-version Android 4.4
Realm version: 1.2.0
I wonder if this happened during application update.
Still, my guess is also that multi-process support will fix this in 2.0... when that arrives
I have the same problem here:
Fatal Exception: io.realm.exceptions.RealmError: Could not open the Realm file: Incompatible lock file. Info size doesn't match, 1120 1160.
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SourceFile:112)
at io.realm.internal.SharedGroup.(SourceFile:74)
at io.realm.internal.SharedGroupManager.(SourceFile:49)
at io.realm.BaseRealm.(SourceFile:86)
at io.realm.DynamicRealm.(SourceFile:50)
at io.realm.DynamicRealm.createInstance(SourceFile:183)
at io.realm.RealmCache.createRealmOrGetFromCache(SourceFile:128)
at io.realm.DynamicRealm.getInstance(SourceFile:67)
at com.example.realm.RealmHelper.init(SourceFile:62)
at com.example.AppApplication.onCreate(SourceFile:91)
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)
Only happened on a Samsung GT-I9301I so far, running 4.4.2
@AlexLardschneider @wbervoets When reporting bugs - please do remember to list which version of Realm you are using. Thanks!
@bmunkholm oh sorry, using Realm 1.2.0
@AlexLardschneider did you by chance update the app lately with a change in Realm version?
@Zhuinden there has been an update from 1.1.0 to 1.2.0.
@cmelchior wait a second, is it possible that this error happens because the application was open (and therefore has lock files) when the update was started, and when the next version of Realm starts, it sees the lock files that remained from the previous Realm version and then thinks it shouldn't be able to open the Realm even though it's not being used anymore?
Yes, that is our working theory right now. The lock file should only be there if the file is being used. From what we know it shouldn't be possible for an app to have two concurrent processes, but we have from hearsay that apparently there has been bugs in the Play Store updater that actually did this. We haven't been able to verify it though.
Two processes accessing a lock file is actually fine. That is the entire point of the file, but it doesn't work if the two versions of Realm expect a different file format. Which is why if this is the root cause, you should only see these errors while upgrading the app.
@cmelchior technically I wonder if the lock files can stay there and "be in the way" because the update terminates the process without closing the Realm (and thus there will be lingering locks around from the previous version that are never removed)
We always leave the lockfile behind. We use filelocks on the lockfile (sorry) to determine if another instance is actually using the lockfile, and if not we reinitialize it. In other words, logic is in place to detect and handle the situation you describe. But obviously, the persistence of this error suggests a flaw in our way of handling it. The kernel automatically lifts filelocks held by a process when it dies. We allow the kernel several seconds to do that before signalling the error.
@finnschiermer So I guess it cannot be reinitialized because the kernel is still holding it, but when does the incompatible lock version
check come in?
I don't really trust the kernel on this one, there seems to be no guarantee that the lock is released immediately after the process is killed for updating. I wonder if Realm could be more lenient about lock versions if the version it sees is older?
Simplified version: After determining that another process has a lock on it, we proceed to check if the lockfile format match. The lockfile is not just a locking mechanism. It holds metadata used to provide concurrent access to multiple different versions of data. If the format of the lockfile does not match, we cannot coordinate access to the realm file reliably so we throw the exception.
But this is just a hypothesis. We don't know the cause of the bug for certain. We don't have a repro-case. Were we to develop an alternative check, we'd risk introducing new errors and have no easy way to verify that we actually solved this one.
I've just released a version of my app with realm version upgrade from 1.1.0 to 1.2.0. Seeing a lot of crashes specifically for android 4 (100% of them)
Fatal Exception: io.realm.exceptions.RealmError
Could not open the Realm file: Incompatible lock file. Info size doesn't match, 1120 1160.
Is it possible to do catch RealmError and perform Realm.deleteRealm(configuration)?
@vytautasgimbutas Sorry for the late response. Yes, that is possible. Just be aware that RealmError could be thrown for other reasons as well, like running out of memory and deleting the Realm in that case might be a bit harsh.
The exception changes after 2.0:
Copy the issue report from #3634
I update realm to 2.0.2, then this exception comes a lot which never happened before. This Exception is happened in a IntentService and share RealmConfiguration Object with main process.
Fatal Exception: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 81
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:178)
at io.realm.BaseRealm.(BaseRealm.java)
at io.realm.Realm.(Realm.java)
at io.realm.Realm.createAndValidate(Realm.java:284)
at io.realm.Realm.createInstance(Realm.java:265)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:143)
at io.realm.Realm.getInstance(Realm.java:228)
Realm version(s): 2.0.2
I have started to receive this issue as well
Fatal Exception: io.realm.exceptions.RealmError: Could not open the Realm file: Incompatible lock file. Info size doesn't match, 1112 1160.
at io.realm.internal.SharedGroup.openSharedGroupOrFail(SharedGroup.java:112)
at io.realm.internal.SharedGroup.<init>(SharedGroup.java:74)
at io.realm.internal.SharedGroupManager.<init>(SharedGroupManager.java:49)
at io.realm.BaseRealm.<init>(BaseRealm.java:86)
at io.realm.Realm.<init>(Realm.java:135)
at io.realm.Realm.createAndValidate(Realm.java:233)
at io.realm.Realm.createInstance(Realm.java:214)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:126)
at io.realm.Realm.getInstance(Realm.java:178)
App is build with
minSdkVersion 16
targetSdkVersion 24
buildToolsVersion "24.0.3"
with "io.realm:realm-gradle-plugin:1.2.0"
Devices that are effected are
Samsung SM-J110F (4.4.4)
Samsung GT-I9505 (4.4.2)
Couldn't you delete only the lock-file in such case?
The same for us.
Fatal Exception: java.lang.RuntimeException: Unable to create application pl.our.app.Aplication: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. in /Users/zaki/fromgit/realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92 Kind: INCOMPATIBLE_LOCK_FILE.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4750)
at android.app.ActivityThread.access$1500(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
Caused by io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. in /Users/zaki/fromgit/realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:205)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:182)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:124)
at io.realm.Realm.getDefaultInstance(Realm.java:211)
at pl.our.app.injection.module.ApplicationModule.provideRealm(ApplicationModule.java:143)
at pl.our.app.injection.module.ApplicationModule_ProvideRealmFactory.get(ApplicationModule_ProvideRealmFactory.java:1023)
at pl.our.app.injection.module.ApplicationModule_ProvideSettingsServiceFactory.get(ApplicationModule_ProvideSettingsServiceFactory.java:1038)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at pl.our.app.service.PushNotificationService_MembersInjector.injectMembers(PushNotificationService_MembersInjector.java:1045)
at pl.our.app.injection.component.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:1667)
at pl.our.app.service.PushNotificationService.(PushNotificationService.java)
at pl.our.app.injection.module.NetModule_ProvidePushNotificationServiceFactory.pl.our.app.injection.module.NetModule.providePushNotificationService(NetModule_ProvidePushNotificationServiceFactory.java:1095)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at pl.our.app.Application_MembersInjector.injectMembers(Application_MembersInjector.java:1040)
at pl.our.app.injection.component.DaggerApplicationComponent.inject(DaggerApplicationComponent.java:1434)
at pl.our.app.Application.onCreate(Application.java:93)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1014)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4747)
at android.app.ActivityThread.access$1500(ActivityThread.java:166)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1343)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5584)
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:1268)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)
at dalvik.system.NativeStart.main(NativeStart.java)
Realm 2.1.1
We are using Firebase Push Notifications and also have Pushwoosh service implemented (for not migrated users). I thought it can be important.
More info from Crashlytics
Devices:
100% samsung
SM-T230 40%
SM-T113 21%
GT-I9060I 21%
Other… 18%
Android:
4.4.4 61%
4.4.2 39%
@PiotrWpl Firebase opens a second process for itself, so if you open Realm using Realm.getDefaultInstance()
in CustomApplication.onCreate()
, then this can happen.
I've been thinking that such initialization logic should be moved to a BaseActivity
instead.
@Zhuinden Thank You! We will try to change our implementation tomorrow. But before that, I have one more question. Before upgrade Realm to 2.x we didn't had this crash (and our initialization, Realm & Firebase, was the same as now). Do You still think it's possible, and it's worth to try move initialization logic?
P.S: Sorry for my English.
@PiotrWpl this exact same crash used to be called RealmError: Incompatible Lock File
even back in Realm 1.2.0 and before. This is technically multi-process access of the Realm file, which isn't officially supported yet.
But if the Firebase Process does not need the Realm (which it probably does not), then if a BaseActivity
initializes this stuff only once per app start, then this issue won't occur.
@Zhuinden
But if the Firebase Process does not need the Realm (which it probably does not), then if a BaseActivity initializes this stuff only once per app start, then this issue won't occur.
We use Realm in our extended FirebaseMessagingService to create push history for users, which they can browse after app start. Do You see any solution in that case?
One more time, thank You very much!
We are getting this same issue since updated to 2.2.1 from 1.2.0.
As far as I can see from merged AndroidManifest, there should be no other process.
Fatal Exception: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:205)
at io.realm.BaseRealm.(BaseRealm.java:82)
at io.realm.Realm.(Realm.java:138)
at io.realm.Realm.createAndValidate(Realm.java:283)
at io.realm.Realm.createInstance(Realm.java:264)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:143)
at io.realm.Realm.getDefaultInstance(Realm.java:209)
at com.my.app.util.RealmUtil.getWithoutCounting(RealmUtil.java:250)
at com.my.app.util.RealmUtil.get(RealmUtil.java:224)
at com.my.app.service.PushCustomService.onHandleIntent(PushCustomService.java:132)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.os.HandlerThread.run(HandlerThread.java:61)
this is happening on various devices, such as:
LG LGV31 4.4.2
LG LGL22 4.4.2
Sony SOL23 Xperia Z1 4.4.2
Sony SOV32 Xperia Z5 6.0.1
Samsung SCL23 6.0.1
Sharp SH-07E AQUOS PHONE si 4.2.2
@PiotrWpl You have to ensure that all access to the Realm is from the same process.
@yshrsmz Is it 100 % reproducible? Or do you see it only sometimes? If it is reproducible, we would be happy to see your code.
Version 2.2.1. There is only one process in the app. Same stacktrace as @yshrsmz. Sadly I cannot reproduce it, happens quite rarely. I can add
Acer A1-810
Lenovo A5000
to the devices, that do it.
@kneth Sorry, I cannot reproduce this. But will do deeper investigation and get back to you when I find anything.
This should be a priority issue. Happens quite a lot in 2.2.1. We have about 250 of these crashes per week in our app.
@slezadav what sucks is that it cannot be reproduced all that easily.
It seems to only occur if the app is running while Google Play updates the application.
Debugging that sounds somewhat difficult.
P.S. I'm not a Realm member.
We just got a new set of reports of this crash on releasing our latest beta. We recently updated to Realm 2.2.1. There is only one process in our app.
Like last time this happened to us, it's a large number of crashes, but small number of users. It seems that once the lock file is in this bad state, subsequent launches by the user will always result in this crash.
@lisawray Thanks for the reporting that observation. @finnschiermer Is there any easy fix to make core more robust when it comes to malformed lock files?
@slezadav @yshrsmz Do you share @Zhuinden's observation that Google Play updates might cause issues?
@kneth in my opinion this is not related with Google Play updates. Many of our users are reporting in comments and mails that our app stop working after update to new version (with Realm 2.x). So this state is permanent.
List of affected devices (all of them have Android 4.x), and they are mostly tablets:
Currently we are trying to gather more information from our users (for example about apps installed, like antivirus) and get one of these devices to make some tests. But it will take some time.
@PiotrWpl Thank you for the update and the long list of devices. None of our test devices are on the list (we have a Samsung SM-T110 and a GT-I8190 at the office). Antivirus and other security enhancements (like Samsung Knox) could be interesting to know more about.
@kneth @beeender
Finally I have a sample code, which one showing app crash on Samsung SM-T110.
Please check this -> https://github.com/PiotrWpl/realmCrashSample/blob/master/app/src/main/java/demo/realm/crashsample/MainActivity.java
I just created "Empty Activity" through Android Studio Wizard, added Realm 2.2.2 to Gradle and I added just two line of code in MainActivity.java on the end of onCreate:
Realm.init(this);
Realm.getDefaultInstance();
It's crashing every time. Without Realm.getDefaultInstance();
is ok.
I have notice that it happen just after call
Lines 238-240 SharedRealm.java
public void setSchemaVersion(long schemaVersion) {
nativeSetVersion(nativePtr, schemaVersion);
}
Tested on:
Samsung SM-T110
Android 4.2.2
Full logcat:
crashSample.txt
SM-T110 and SM-T111 is a different error https://github.com/realm/realm-java/issues/3651
Hey all,
We have also been experiencing this issue since updating Realm from 1.1.1 to 2.0.1.
Caused by io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 81
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:178)
at io.realm.BaseRealm.(BaseRealm.java)
at io.realm.Realm.(Realm.java)
at io.realm.Realm.createAndValidate(Realm.java:284)
at io.realm.Realm.createInstance(Realm.java:265)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:143)
at io.realm.Realm.getDefaultInstance(Realm.java:210)
Below is a list of affected devices and android versions.
Samsung:
SM-P601
SM-T116
SM-G900H
Blackberry:
Z3
Z10
Q10
Sony:
E2303
F3112
SGP321
Android versions:
4.X
5.X
6.X
@PiotrWpl Your problem is not related with this issue but it is the same issue with #3651 . We have a workaround for it which has been released in v2.3.0
. Please update to the new version.
@beeender I actually wonder if some of those could be because of the armeabi
to armeabi-v7
change.
Another set of those are probably updating the app while the app is already running, and the lock file isn't released, or at least that was the hypothesis 4+ months ago.
@Zhuinden
I actually wonder if some of those could be because of the armeabi to armeabi-v7 change.
But that assumption based on those devices were using armeabi
before. There are quite a few device prefer armeabi
than armeabi-v7
I think?
I don't think so. We had armeabi excluded in Realm 1.x.
packagingOptions {
exclude "lib/mips/librealm-jni.so"
exclude "lib/armeabi/librealm-jni.so"
}
And there wasn't any problems on these devices.
Several days ago, one of my colleague said he got this error on debug build.
Though he haven't been able to reproduce the error, this means the issue may not be related to Google Play Store.
Device : Nexus6
OS : 7.0
Android security patch: 2016/11/5
baseband: MDM9625_104670.31.05.42R
kernel:
3.10.40-g9f039ba
[email protected] #1
Mon Sep 19 22:48:01 UTC 2016
build: NBD91P
@yshrsmz Can you colleague supply any more details? Things like what was he doing at that time? Is he trying to install a new version apk through adb? Anything may cause the devices was running two processes from the same apk?
Any clues are appreciated. I have been tried to reproduce this for days, but no luck.
@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.
Is he trying to install a new version apk through adb?
no
Anything may cause the devices was running two processes from the same apk?
as far as I can see from merged AndroidManifest, our app does not have other processes.
Update: I myself got this error on a debug build after leaving the app open for over a day. (The situation is same as previous one. not trying to update/install, should be no other process)
As well as usual Realm file is currently open in another process...
error message, I found that a following message is there everytime I see Realm file is currently open in another process...
message.
E/System: Uncaught exception thrown by finalizer
E/System: java.lang.NullPointerException: Null reference used for synchronization (monitor-enter)
at io.realm.internal.SharedRealm.finalize(SharedRealm.java:348)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
Realm version: 2.2.2
Device: Nexus 6
OS version: 7.0 (security patch: 2016/10/05)
Actually this is happening on a device currently attached to Android Studio(yes, I can put break point!).
So I think I can provide more info if you tell me what to do.
@yshrsmz hi!! sorry, i just saw your response! Is the debugger still attached?
Can you please do a adb shell lsof > lsof_output.txt
and send the output file to me?
@beeender just sent a mail to [email protected]
Subject is "About realm-java #2459"
Today I received the same crash, I got this stack trace from Fabric:
Fatal Exception: java.lang.Error: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 771 8.) in /home/cc/repo/realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92 Kind: INCOMPATIBLE_LOCK_FILE.
at io.realm.AndroidNotifier.throwBackgroundException(AndroidNotifier.java:138)
at io.realm.RealmQuery.closeSharedRealmAndSendEventToNotifier(RealmQuery.java:2239)
at io.realm.RealmQuery.access$000(RealmQuery.java:62)
at io.realm.RealmQuery$2.call(RealmQuery.java:1760)
at io.realm.RealmQuery$2.call(RealmQuery.java:1730)
at io.realm.internal.async.BgPriorityCallable.call(BgPriorityCallable.java:36)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 771 8.) in /home/cc/repo/realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:209)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:186)
at io.realm.RealmQuery$2.call(RealmQuery.java:1737)
at io.realm.RealmQuery$2.call(RealmQuery.java:1730)
at io.realm.internal.async.BgPriorityCallable.call(BgPriorityCallable.java:36)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Additional info:
Device: Nexus 6P (not mine)
Android version: 7.1.1
Realm version: 2.3.0
Use compactRealm(RealmConfiguration configuration)
: Yes, after activity and Realm is closed.
@kleisauke The same problem.
@DenysZP Can you provide details about your app and when you see this error message?
Hi,
I wonder if the crash is occurred, how will it be resolve?
Some users occurred the crash repeatedly.
http://crashes.to/s/c3a06901185
Realm 2.3.1 (previous 1.0.0)
buildToolsVersion 25.0.2
Play-services-base 8.4.0
I don't use Firebase explicitly.
I'm not using multi-process.
@jangc You mention two Realm versions. Does the crash happen after upgrading the app (and thereby Realm from 1.0.0 to 2.3.1)?
@kneth Yes it is.
Realm Java 1.0.0 uses Realm Core 1.0.0, and Realm Java 2.3.1 uses Realm Core 2.2.0. The management of commit logs has change, and the .lock
file has changed too. The Android app updater might be unpredictable, and overwriting our .so
file can cause a crash. Can your users recreate the data easily if you remove the Realm file?
FYI: I've seen this crash in Fabric when I upgraded Realm from 2.2.0
to 2.3.0
(I've not updated my app since November 18, 2016. The update was released on February 5, 2017). I'm still unable to reproduce this crash on my own device.
Is it possible that this crash occurs due to the new delta algorithm of Google Play?
@kneth Yes, they can. But it is an alarm app...
Anyway, thank you for your reply.
@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.
@diegomontoya Thank you for your advice. But it occurred on marshmallow's Service.onStartCommand. If there is no guarantee, I met other problems related with multi-process before updating.
I see the same in my app as well: RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 771 8.)
Here is a more complete backtrace https://sentry.io/share/issue/3136303533312e323631343835363636/
I'm using Realm 2.3.1
Affected devices are:
Affected Android versions are:
@snowpong Is it possible to upgrade to a later version of Realm Java?
3.1.4 is much more stable, although you need to look at whether you are affected by breaking changes.
Can confirm the issue is still there in 3.3.0 verison.
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{com.***./com.***.SplashActivity}: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Info size doesn't match, 1160 1184.) (/data/data/com.***./files/AppRealm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 230 Kind: INCOMPATIBLE_LOCK_FILE.
Affected devices:
Affected Android versions:
I am trying to make a workaround for this issue based on our assumption:
It is caused by the old apk process is not terminated correctly when updating the apk file then start the new apk process. And this is the only possible cause we can possibly imagine.
So the idea of the workaround is quite simple:
BuildConfig.VERSION_CODE
and valued saved in the SharedPreference
. If it is not the first time, do nothing then.The step 2 is implemented in JNI by iterating the /proc
directory. It is not like the standard Android way to do it (by ActivityManager
), but generally it should work on any linux. (Anyone know if there is any chance it would fail? )
Also, I don't think this should go to the realm lib since it is trying to kill user's process behind user's back. And it is a really unnecessary hack for a really silly Android bug (if there is a bug). So anyone think it worth to try, can check the repo here https://github.com/beeender/KillOthers . It is still not a library project, so you need to integrate two files with your project. https://github.com/beeender/KillOthers/blob/master/app/src/main/java/io/beeender/killothers/Killer.java and https://github.com/beeender/KillOthers/blob/master/app/src/main/cpp/native-lib.cpp .
The logic and the concept has been tested on a linux machine, but the fix itself has not been tested since we have no way to reproduce the issue.
From all the reports we got, we don't think it is a visible crash to users. And the crash rate will be much lower after more users update. So it should only happen to very a few users at the first time they update the apk with a Realm lock file format update (not every realm updates will upgrade the lock file format). So maybe it doesn't worth to try to fix it.
USE IT AT YOUR OWN RISK
https://stackoverflow.com/questions/25551368/two-android-app-processes-with-the-same-name-why
This looks like the quite same problem as what we met now, the old process has not been killed.
I am also seeing this issue in 3.7.2 within an AsyncTask
BuildTools 26
Caused by io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 259 10.) (/data/data/com.soudfa/files/default.realm) in /home/cc/repo/realm/release/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 91
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:227)
at io.realm.BaseRealm.(BaseRealm.java)
at io.realm.BaseRealm.(BaseRealm.java)
at io.realm.Realm.(Realm.java)
at io.realm.Realm.createInstance(Realm.java:417)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:348)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:281)
at io.realm.Realm.getDefaultInstance(Realm.java:325)
at com.soudfa.Models.Account.CollectionAccount$1.doInBackground(CollectionAccount.java:112)
at com.soudfa.Models.Account.CollectionAccount$1.doInBackground(CollectionAccount.java:108)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
I upgraded Realm from 2.3.0
to 4.1.1
. When the app was available on the Play Store, I received fairly quickly this stack trace on Fabric:
Stack trace
Fatal Exception: java.lang.RuntimeException: Unable to create application nl.kleisauke.rocrooster.TimeTableApplication: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Info size doesn't match, 1160 1184.) (/data/data/nl.kleisauke.rocrooster/files/default.realm) in /Users/Nabil/Dev/realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 101 Kind: INCOMPATIBLE_LOCK_FILE.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4612)
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)
Caused by io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Info size doesn't match, 1160 1184.) (/data/data/nl.kleisauke.rocrooster/files/default.realm) in /Users/Nabil/Dev/realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 101
at io.realm.internal.SharedRealm.nativeGetSharedRealm(SharedRealm.java)
at io.realm.internal.SharedRealm.(SharedRealm.java)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:219)
at io.realm.internal.SharedRealm.getInstance(SharedRealm.java:209)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:319)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:282)
at io.realm.DynamicRealm.getInstance(DynamicRealm.java:100)
at nl.kleisauke.rocrooster.TimeTableApplication.onCreate(TimeTableApplication.java:79)
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)
Additional info:
Device: Galaxy S3 Neo (not mine)
Android version: 4.4.2
Realm version: 4.1.1
So I can confirm that this crash (which may not be visible to users), only happens when users update their APK. When Realm 4.2.0 is released (which supports Realms in multiple processes), I can update my app and see if this issue persists.
I've checked ActivityManager#getRunningAppProcesses()
when the crash happens, but it seems like there is only one process(though I'm not sure if this method can recognize processes correctly)
I'll be curious to see if https://github.com/realm/realm-core/pull/2902 has any impact on this (Core 4.0.3)
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.
@beeender thanks for this!
I can't wait to release it here.
I have a question, in the changelog it is saying that will be released in 4.1.2
and in your comment says 4.2.0
. Could you confirm what version it will be released and approximately when?
https://github.com/realm/realm-java/blob/master/CHANGELOG.md
normally bug fixes go to the patch release so it would be released earlier before the next minor release. But it's likely that our next release will be a minor release. so the 4.1.2
will be skipped and fold everything into 4.2.0
:)
@alessandrojp
@beeender understood, I hope it can be released very soon :)
many thanks!!
Hi, I'm investigating this issue right now.
Now that 4.2.0 is out, did anyone have the chance to upgrade to this version? Did this fix the issue?
Thanks
I ran into this issue with 4.2.0. I'm sure there are deeper underlying problems with the realm lifecycle management. Though I solved this issue by wrapping all "getDefaultInstance" calls with a synchronized block in a helper method.
This also alleviated a few other outstanding issues with the application code. It would appear that getDefaultInstance is not as thread safe as I once believed.
@EE-GSlomin do you by chance know which kind of "outstanding issues" it fixed?
Hello, I am still getting this error
io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 771 10.) (/data/data/org.vom8x8.sipua/files/VOM_DB) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 Kind: INCOMPATIBLE_LOCK_FILE.
at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(Native Method)
at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171)
at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241)
at io.realm.BaseRealm.<init>(BaseRealm.java:136)
at io.realm.BaseRealm.<init>(BaseRealm.java:103)
at io.realm.Realm.<init>(Realm.java:163)
at io.realm.Realm.createInstance(Realm.java:499)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:360)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:290)
at io.realm.Realm.getInstance(Realm.java:428)
I am using io.realm:realm-gradle-plugin:6.1.0
. getInstance
is called from multiple looper threads and there are no repro steps. Any idea on how to address this or what might be the cause?
Hi @beeender! Same as couple of guys mentioned above, I'm experiencing what seems to be the same issue on version 5.14.0
when calling Realm.getDefaultInstance()
. Unfortunately weren't able reproduce the issue locally and only get it in Crashlytics reports from time to time. Do you have any thoughts on why can this be still happening and/or any workarounds/checks I can perform on the application code side to avoid it?
Fatal Exception: io.realm.exceptions.RealmFileException: Realm file is currently open in another process which cannot share access with this process. All processes sharing a single file must be the same architecture. (Incompatible lock file. Shared info version doesn't match, 771 10.) (/data/data/<package_name>/files/default.realm) in /Users/jasonflax/Development/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101
at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(OsSharedRealm.java)
at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:171)
at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:241)
at io.realm.BaseRealm.<init>(BaseRealm.java:136)
at io.realm.BaseRealm.<init>(BaseRealm.java:103)
at io.realm.Realm.<init>(Realm.java:163)
at io.realm.Realm.createInstance(Realm.java:499)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:355)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:285)
at io.realm.Realm.getDefaultInstance(Realm.java:407)
@AlexeiVoice This should only happen if you try to open a Realm file that was copied to a different architecture with all our lock files in place
In general, this should not be possible on Android devices. It happens when you try to open a Realm file that was already opened on a different ABI architecture, e.g. 32 bit vs. 64 bit. This should never happen with normal use.
My best guess is:
1) Someone copied an entire app from the phone to a different architecture and tried to run it there, e.g. copied it from a phone and ran it on an emulator.
2) You are mistakenly shipping our lock files with your app (highly unlikely).
@cmelchior This issue should be reopened. Our crash rate is constant with this stack trace over last few versions of Realm. Our app is managed by Google Play, so I don't understand how we could mistakenly ship lock files with our app.
@mirceasotan Instead of reopening this issue, it would probably be better to create a new issue. Since this one has a lot of discussions probably not relevant to your issue (and the original error pertains a really old version of Realm).
We are specifically interested in getting any details of:
1) What Android devices / versions does this happen on
2) Does it happen after upgrading or "in general"
3) Do you have encryption enabled
@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.
@AlexeiVoice please have a look at https://github.com/realm/realm-java/issues/7102#issuecomment-703557824 as it could explain why you experience this.
@edualonso Thanks, that sounds like one of the most logical explanation! I've checked our manifest and it looks like we have android:allowBackup = false
in our app, so unfortunately this one can be excluded from the possible reasons in our case.
@AlexeiVoice that's unfortunate :( Is it possible that perhaps the setting was enabled at some point and then it got turned off?
@edualonso Yeah :( no, unfortunately it's been this way for quite some time
Most helpful comment
I don't think so. We had armeabi excluded in Realm 1.x.
And there wasn't any problems on these devices.