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

Unable to open a realm at path default.realm on Android #1714

Closed
MrHubble opened this issue Mar 15, 2018 · 4 comments
Closed

Unable to open a realm at path default.realm on Android #1714

MrHubble opened this issue Mar 15, 2018 · 4 comments

Comments

@MrHubble
Copy link

MrHubble commented Mar 15, 2018

I am using Realm with React Native. Previously my Android build process kept getting stuck on 93%. The fix was rm -r default.realm* && rm -r realm-*, after which my build would complete successfully.

However, now the first time I go to use my app it will crash with errors similar to unable to open a realm at path default.realm, not a realm. After reloading, the app works fine and will no longer throw an error. So to replicate the bug I need to constantly delete the app from my Android device.

I can not replicate this bug when stepping through the code, it only occurs if I disable remote debugging.

This I have tried:

  • Opening the realm asynchronously rather than synchronously
  • Manually specifying the path (ie Realm.open({ path: 'myRealm.realm'
  • Closing the realm
  • Unlinking and removing Realm from the project and then adding it back again

Version of Realm and Tooling

  • Realm JS SDK Version: 2.3.0
  • Node or React Native: 0.48.4
  • Client OS & Version: Mac OSX 10.13.3
  • Which debugger for React Native: Chrome
@MrHubble
Copy link
Author

I was able to re-add all of the realm files I deleted (rm -r default.realm* && rm -r realm-*) however the problem still exists.

Often the app will just crash and reload and will not throw an error though sometimes it does when running a release version. After assembling a release and running on my Android device I was able to get this error:

error

@MrHubble MrHubble changed the title Unable to open path at default.realm after rm -r default.realm* Unable to open a realm at path default.realm on Android Mar 16, 2018
@MrHubble
Copy link
Author

Further debugging

This issue suggests encryption may be the culprit, so I thought removing the encryption option might change something:

image

Unfortunately not, now I am receiving a schema version difference. I thought 'somehow' the DB on the device was actually 31 and not the defined 47 so I changed the schema version to 31 to verify:

image

Okay... So somehow the schema version is correct? I assumed that removing the schema version and encryption option should be okay as I was planning to uninstall the application and reinstall to test the scenario, recreating the DB and not requiring migrations or a schema version at all:

image

Only to reveal a new raised issue that must be library unrelated (I can't find its reference).

Using android studio and a created emulator, I pulled the realm file once the application was started and running before the issue occurs, and have found nothing unusual with the file. The DB opens up using realm studio with the encryption turned off, and everything looks as though it has been successfully stored.

@kneth
Copy link
Contributor

kneth commented Apr 3, 2018

@MrHubble I can't give you a definite answer. The old bug, you are referring to was related to a race-condition when multiple threads were writing and reading an encrypted Realm. Since it has been fixed, I don't think what you see is related.

The last screen shot seems to be unrelated to Realm.

@bmunkholm
Copy link
Contributor

Outdated. Feel free to reopen in case this is still relevant.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 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