Skip to content
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

RealmFileException: Not a Realm file & Permission denied #5643

Closed
watabee opened this issue Dec 26, 2017 · 3 comments
Closed

RealmFileException: Not a Realm file & Permission denied #5643

watabee opened this issue Dec 26, 2017 · 3 comments

Comments

@watabee
Copy link

watabee commented Dec 26, 2017

Expected Results

No crash.

Actual Results

We updated Realm version from 1.0.0 to 4.3.1, then We've got some crash reported by crashlytics.

# OS Version: 6.0.1
# Device: Nexus 7 (2013)
# RAM Free: 31.3%
# Disk Free: 22%

Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/our.package/files/default.realm': Not a Realm file. (Not a Realm file) (/data/data/our.package/files/default.realm) in /Users/cm/Realm/realm-java-release/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.(OsSharedRealm.java)
       at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:254)
       at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:244)
       at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:319)
       at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:282)
       at io.realm.Realm.getDefaultInstance(Realm.java:332)

# OS Version: 6.0.1
# Device: Xperia Z3 Compact
# RAM Free: 50.2%
# Disk Free: 6.5%

Fatal Exception: io.realm.exceptions.RealmFileException: Unable to open a realm at path '/data/data/our.package/files/default.realm.lock'. Please use a path where your app has read-write permissions. (open("/data/data/our.package/files/default.realm.lock") failed: Permission denied) (/data/data/our.package/files/default.realm.lock) in /Users/cm/Realm/realm-java-release/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.(OsSharedRealm.java)
       at io.realm.internal.OsSharedRealm.getInstance(OsSharedRealm.java:254)
       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:424)
       at io.realm.RealmCache.doCreateRealmOrGetFromCache(RealmCache.java:342)
       at io.realm.RealmCache.createRealmOrGetFromCache(RealmCache.java:282)
       at io.realm.Realm.getDefaultInstance(Realm.java:332)

screen shot 2017-12-26 at 10 50 45

Steps & Code to Reproduce

Sorry, we couldn't reproduce this crash.

Code Sample

// onCreate() in Application 
Realm.init(this);
RealmConfiguration config = new RealmConfiguration.Builder()
        .schemaVersion(7)
        .migration(new Migration())
        .build();
Realm.setDefaultConfiguration(config);
// onResume() in Activity
final Realm realm = Realm.getDefaultInstance(); // Crash

Version of Realm and tooling

Realm version(s): 4.3.1

Realm sync feature enabled: no

Android Studio version: 3.0.1

Which Android version and device:

  • Nexus 7 6.0.1
  • Xperia Z3 Compact 6.0.1
  • Nexus5 6.0.1
  • AQUOS EVER SH-04G 5.0.2
  • Xperia Z Ultra 4.4.2
  • and so on.

How can we solve this problem? Thanks.

I'm sorry for my poor english.

@beeender
Copy link
Contributor

The first one feels like a db file corruption.

The 2nd one seems to a similar issue described here #3972 (comment)

But without a reproduce case, it is hard to tell the what is problem (could be problem in the device side :( )

@watabee
Copy link
Author

watabee commented Dec 28, 2017

OK, if I could reproduce this case, I reopen this issue.
Thanks!

@watabee watabee closed this as completed Dec 28, 2017
@i-m-aman
Copy link

i-m-aman commented Nov 9, 2018

have you ever been able to reproduce this issue??

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants