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

Illegal Argument: Invalid format of Realm file

Open hohnamkung opened this issue 10 years ago • 12 comments

Actual Results

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)

Steps & Code to Reproduce

I can't reproduce it. But what i found out is that it happen where each realm configuration's instance is first created.

This exception is grouped with Fatal Exception: io.realm.exceptions.RealmError Unrecoverable error. Incompatible lock file., i don't know exact ratio of version or device.

Version of Realm and tooling

Realm version(s): v0.88.2

Which Android version and device: I think most of crash came from 4.1.1 or 4.1.2 (based on each exception log what i saw)

hohnamkung avatar Mar 17 '16 03:03 hohnamkung

Thank you for the report. We are trying to reproduce it.

emanuelez avatar Mar 21 '16 07:03 emanuelez

Got the same exception today, 12 crashes from one device (Samsung GT I9070). Also I couldn't reproduce it. (Realm version: v0.87.4)

Link to Crashlytics: http://crashes.to/s/5b01662b2eb

kleisauke avatar Apr 04 '16 16:04 kleisauke

Impact for this issue is really worrying right now, 201 crashes from 18 users.

screen shot 2016-04-19 at 7 13 57 pm

I'm using Realm 0.87.4 and not using compactRealm.

I hope we can find fix for this issue without having to wipe existing realm data from user device.

Link to crash logs: http://crashes.to/s/2a88f9cb731

@kleisauke did you use Realm.compactRealm in your app?

kemasdimas avatar Apr 19 '16 12:04 kemasdimas

@kemasdimas I'm not using Realm.compactRealm in my app.

kleisauke avatar Apr 19 '16 15:04 kleisauke

@kemasdimas @kleisauke @hohnamkung Version 0.90.1 of Realm includes a fix of a potential race condition which might affect your apps. The race condition is only met in very rare situations, and since I don't know your apps, I can't say that we have fixed the issue.

But please try to upgrade to 0.90.1 and see if the issue still occurs.

kneth avatar May 17 '16 12:05 kneth

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 avatar May 25 '16 12:05 cmelchior

2016-11-06 20 04 28 Is this related with issue?

Yura-Savchuk avatar Nov 06 '16 18:11 Yura-Savchuk

@coulCod depends on your Realm version

Zhuinden avatar Nov 06 '16 18:11 Zhuinden

I am use classpath "io.realm:realm-gradle-plugin:1.2.0"

Yura-Savchuk avatar Nov 06 '16 18:11 Yura-Savchuk

@Zhuinden If you need more information I can take.

Yura-Savchuk avatar Nov 07 '16 12:11 Yura-Savchuk

@coulCod I'm not an official Realm person, and I can't really help with this issue.

This is possibly a result of database corruption. While I've had this happen to me because of transactions that were neither cancelled nor committed, otherwise files can get damaged without really anything specific causing them.

Zhuinden avatar Nov 07 '16 12:11 Zhuinden

In general, Realm is robust but we have seen issue when Realm files are restored (by an external process) while an app is running. And upgrading a running app might cause issues (again, an external process).

kneth avatar Nov 08 '16 09:11 kneth