-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to open a realm at path. ACCESS_ERROR: Invalid mnemonic #6257
Comments
Thanks @TTransmit! If you can send that file to help@realm.io and mention this github issue we will be grateful. |
Also, If you can post as many of stack traces as possible it would really help a lot. The different values here can help us narrow down where the problem might be |
This bug is now being tracked in Core here realm/realm-core#3134 Some notes about this error:
If this value isn't present we will throw the error seen in this issue. The most likely cause of this value being wrong is that something else than Realm manipulated the file in a wrong way, examples:
Note that Realm API's exists that that does both of these things but to our knowledge, these should all be safe to use. This includes Android provides automatic API's that can backup and restore files: https://developer.android.com/guide/topics/data/autobackup but according to its documentation it should only run when the app is killed preventing race conditions here as well. |
@TTransmit Any information you have regarding how the Realms are being opened/manipulated would be very valuable. Especially if you copying Realms from assets, deleting or copying the files. If you can share your RealmConfiguration that would also help. From the stack traces you sent, it seems you have different errors happening to |
Info from #6284
@imvikasrai The mnemonic is all zeros, which indicate a very corrupt file. But without access to the file it is hard to say exactly how much. A few extra questions:
|
I m only deleting all the tables only like this realm.beginTransaction(); I m not deleting the database but realm tables is only deleted when user logged out and this is very rare condition I don't think so user got logged out and I. m not using RealmConfiguration.assetFile() anywhere |
@cmelchior, How can I reproduce this issue?.I m not able to reproduce this issue. At least I want to handle this exception.Will the exception will be thrown when accessing realm?? |
I'm also experiencing this issue with 50 users:
And devices:
None of them are rooted. Some examples (actually, now I see that Crashlytics grouped two type of issues: invalid mnemonic and top ref outside file, are they related?):
It seems this issue started when I upgraded from
Let me know if I can help with additional information. For now, is it safe for me downgrading to 5.1.0 to see if this issue disappear, or are there any breaking changes? |
It also started at the same time that I did a Realm migration, deleting an entire table, like this: This is the way I am initializing Realm:
|
Now I m this handling this exception by accessing realm in onActivityResumed of ActivityLifecycleCallbacks and deleting all files in the internal storage.like this `try{
This issue can be reproduced by corrupting your realm file on any online file corrupt platform and replacing that file with your current file. |
After downgrading to 5.1.0 I am still seeing these crashes, but I think they are from the same 50 users from before, which already have the files corrupted. I think I will have to do the same as @imvikasrai to solve for these users, but ideally, I would like to remove this code in the near future. |
Hi, I added the stack trace and some steps I took to reproduce the error. |
Also affects these devices (I will update it if I found new affected devices):
|
Should be fixed in 6.0.1 (not released yet), but |
Hello there. We are still observing the same issue with Realm 6.0.2: java.lang.RuntimeException: Unable to create application <app_id>.MyApplication: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/<app_id>/files/encrypted.realm': Invalid mnemonic. top_ref[0]: D6C5AF7400000011, top_ref[1]: 88591B63C8C6044D, mnemonic: C7 35 2 54, fmt[0]: 132, fmt[1]: 174, flags: BC Path:Exception backtrace:
<backtrace not supported on this platform>. (Invalid mnemonic. top_ref[0]: D6C5AF7400000011, top_ref[1]: 88591B63C8C6044D, mnemonic: C7 35 2 54, fmt[0]: 132, fmt[1]: 174, flags: BC Path: /data/data/<app_id>/files/encrypted.realm
Exception backtrace:
<backtrace not supported on this platform>) (/data/data/<app_id>/files/encrypted.realm) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 Kind: ACCESS_ERROR.
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5876)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/<app_id>/files/encrypted.realm': Invalid mnemonic. top_ref[0]: D6C5AF7400000011, top_ref[1]: 88591B63C8C6044D, mnemonic: C7 35 2 54, fmt[0]: 132, fmt[1]: 174, flags: BC Path:Exception backtrace:
<backtrace not supported on this platform>. (Invalid mnemonic. top_ref[0]: D6C5AF7400000011, top_ref[1]: 88591B63C8C6044D, mnemonic: C7 35 2 54, fmt[0]: 132, fmt[1]: 174, flags: BC Path: /data/data/<app_id>/files/encrypted.realm
Exception backtrace:
<backtrace not supported on this platform>) (/data/data/<app_id>/files/encrypted.realm) in /Users/cm/Realm/realm-java-release/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 Kind: ACCESS_ERROR.
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.internal.OsSharedRealm.getInstance(OsSharedRealm.java:231)
at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:337)
at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:290)
at io.realm.Realm.getInstance(Realm.java:428) Unfortunately I cannot provide more logs due to NDA. Basically we are injecting Realm Configuration to data layers which have control over |
having same issue on 6.0.2; is it related to encryption?
initializing realm like
crashlytics meta: 76% samsung 43% Android 8 14% In background |
Goal
We have been receiving reports in Crashlytics of crashes due to issues with Realm. These seem to have gotten more frequent in switching from Realm 5.5.0 to 5.7.0. I was able to find the crash myself while looking into a different issue. I have a copy of the corrupted Realm database, which will not open in Realm browser - it says it needs a password, which is not needed for uncorrupted versions of the database. I can send the corrupted database via email. I'm told by another developer that we only access Realm from a single thread.
Actual Results
10-29 15:29:02.574 31851-31851/com.mycompany.dev E/AndroidRuntime: FATAL EXCEPTION: main Process: com.mycompany.dev, PID: 31851 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mycompany.dev/com.mycompany.myfeature.myfeatureActivity}: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/com.mycompany.dev/files/myfeaturedb.realm': Invalid mnemonic. top_ref[0]: 109600030316, top_ref[1]: F3267A703049192, mnemonic: 1F EE EE 35, fmt[0]: 146, fmt[1]: 94, flags: 11. (Invalid mnemonic. top_ref[0]: 109600030316, top_ref[1]: F3267A703049192, mnemonic: 1F EE EE 35, fmt[0]: 146, fmt[1]: 94, flags: 11) (/data/data/com.mycompany.dev/files/myfeaturedb.realm) in /Users/cm/Realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 101 Kind: ACCESS_ERROR.
Steps & Code to Reproduce
The crash occurred first when trying to replicate another issue. The process was starting the app and rapidly backgrounding it many times in a row. The device was connected to Charles Proxy at the time and Charles seemed to be playing up: it looked like it was returning 200 but with no body or headers. I'm not sure if I'm interpreting what Charles was returning correctly.
Version of Realm and tooling
Realm version(s): 5.7.0
Realm Sync feature enabled: No
Android Studio version: 3.2.1
Android Build Tools version: 3.2.1 ? target/compileSdk 28
Gradle version: 4.10.2
Which Android version and device(s): 5.0, Asus Z00AD (Though other Android versions and devices in Fabric Crashlytics)
The text was updated successfully, but these errors were encountered: