realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/user/0/XXX/files/XXX.realm #7706

Closed morevij closed 1 year ago

morevij commented 2 years ago

How frequently does the bug occur?

Sometimes

Description

In our Android mobile app, we have observed this crash error for some of our users since. The pattern is that a new install works fine, then when the app is launched subsequently, they get crashes on startup over and over, when Realm tries to read the file.

Checked previously reported issue https://github.com/realm/realm-js/issues/4358 of realm core where it claimed that this already fixed in latest version But for us its still reported on latest version

Our Realm version we are using 10.11.0

We are using encrypt for DB

Stacktrace & log output

io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/user/0/XXX/files/XXX.realm': Realm file initial open failed: Invalid mnemonic. top_ref[0]: 3531C93134383FBC, top_ref[1]: 600000000000032, mnemonic: 34 34 35 32, fmt[0]: 50, fmt[1]: 52, flags: 37 Path:Exception backtrace:

<backtrace not supported on this platform> Path: /data/user/0/XXX/files/XXX.realm

Exception backtrace:

<backtrace not supported on this platform>. (Realm file initial open failed: Invalid mnemonic. top_ref[0]: 3531C93134383FBC, top_ref[1]: 600000000000032, mnemonic: 34 34 35 32, fmt[0]: 50, fmt[1]: 52, flags: 37 Path: /data/user/0/XXX/files/XXX.realm

Exception backtrace:

<backtrace not supported on this platform> Path: /data/user/0/XXX/files/XXX.realm

Exception backtrace:

<backtrace not supported on this platform>) (/data/user/0/XXX/files/XXX.realm) in /tmp/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_OsSharedRealm.cpp line 107

    at io.realm.internal.OsSharedRealm.nativeGetSharedRealm(OsSharedRealm.java)

    at io.realm.internal.OsSharedRealm.<init>(OsSharedRealm.java:9)

    at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:5)

    at io.realm.BaseRealm.<init>(BaseRealm.java:18)

    at io.realm.BaseRealm.<init>(BaseRealm.java:1)

    at io.realm.Realm.<init>(Realm.java:1)

    at io.realm.Realm.createInstance(Realm.java:1)

    at io.realm.RealmCache.createInstance(RealmCache.java:2)

    at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:13)

    at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:2)

    at io.realm.Realm.getDefaultInstance(Realm.java:5)

    at hm.c.a(RealmDB.kt:1)

    at hm.c.b(RealmDB.kt:1)

Can you reproduce the bug?

Not yet

Reproduction Steps

No response

Version

10.11.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

Yes, using encryption

Platform OS and version(s)

Android almost for all versions

Build environment

Android Studio version: Bumblebee | 2021.1.1 Patch 1 Android Build Tools version: 32.0.0 Gradle version: 7.1.3

rorbech commented 2 years ago

Hi @morevij. The exception indicates that the file has been corrupted. Can you shed some light on:

finnschiermer commented 2 years ago

@morevij Are you using compaction?

github-actions[bot] commented 1 year ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.