realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

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

Open beeender opened this issue 6 years ago • 4 comments

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 avatar Oct 13 '17 08:10 beeender

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"

nganthony avatar Aug 22 '18 14:08 nganthony

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

mrfaa avatar May 21 '19 08:05 mrfaa

➤ Brian Munkholm commented:

Closing as it's related to legacy sync.

sync-by-unito[bot] avatar Dec 15 '21 08:12 sync-by-unito[bot]

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

cmelchior avatar Feb 14 '22 14:02 cmelchior

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

sebdomdev avatar Jun 27 '23 17:06 sebdomdev