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

Need a way to ensure the Realm instance on the sync client thread has been closed #5416

Open
beeender opened this issue Oct 13, 2017 · 7 comments
Labels

Comments

@beeender
Copy link
Contributor

beeender commented Oct 13, 2017

SyncSessionStopPolicy::Immediately is supposed to close the Realm instance on the sync client thread before the close() call on the last Realm instance returned. But it seems it is not doing correctly.

This results:

  1. Realm.deleteRealm() cannot apply to synced Realm.
  2. RealmCache.doCreateRealmOrGetFromCache() for downloadRemoteChanges() cannot clean the Realm file if the downloading failed.
@beeender beeender added the T-Bug label Oct 13, 2017
beeender added a commit that referenced this issue Oct 13, 2017
- Use SharedRealm::call_with_lock() to make sure deleteRealm and
  assetFile calls are process safe.
- Also those calls will throw if the Realm instance on the sync client
  thread is still opened.
- Disallow deleteRealm on a synced Realm file. See #5416 .
- Manually delete SharedRealm pointer if the SharedRealm was created for
  callbacks, eg.: initialization_data_callback and migration_callback.
@nganthony
Copy link

Hey @beeender, will this issue be fixed soon? I currently have a login screen where the user logs into their Google account to sync all their data from Realm. If the user backs out of the login activity, I cancel the RealmAsyncTask which should close the Sync realm and delete the sync realm. I instead get a crash saying "It's not allowed to delete the file associated with an open Realm. Remember to close() all the instances of the Realm before deleting its file"

@mrfaa
Copy link

mrfaa commented May 21, 2019

Hello everybody, is there an update on this issue? I'm currently observing this behavior on my Android 9 device.

@sync-by-unito
Copy link

sync-by-unito bot commented Dec 15, 2021

➤ Brian Munkholm commented:

Closing as it's related to legacy sync.

@sync-by-unito sync-by-unito bot closed this as completed Dec 15, 2021
@cmelchior cmelchior reopened this Feb 14, 2022
@cmelchior
Copy link
Contributor

This is still an issue as the same architecture is present in newer releases.

@sebdomdev
Copy link

sebdomdev commented Jun 27, 2023

In 2023, this is still an issue. Will this be fixed?

@AdelQraft
Copy link

AdelQraft commented Jan 13, 2025

This was in 2017. How is this not yet resolved? What a joke this library is this if one can't even delete a file?

@nirinchev
Copy link
Member

Atlas Device Sync has been deprecated so it's probably best to find another product that does synchronization and allows file deletion 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants