Open flawnn opened 3 months ago
➤ PM Bot commented:
Jira ticket: RDART-1090
The closed property refers to that particular instance and doesn't take into account other components or processes that might be using the realm file at that time. As it was likely the case in the other issue you found, the sync component might hold on to the realm file for a while and prevent you from immediately deleting it. You can either stop the sync session or retry the deletion with some backoff.
The closed property refers to that particular instance and doesn't take into account other components or processes that might be using the realm file at that time. As it was likely the case in the other issue you found, the sync component might hold on to the realm file for a while and prevent you from immediately deleting it. You can either stop the sync session or retry the deletion with some backoff.
How can I stop the sync session in Dart?
realm.syncSession.pause()
this
ProxyService.cron.isolateKill();
final path = realm!.config.path;
// You must close a realm before deleting it
if (realm != null) {
realm!.syncSession.pause();
realm!.close();
}
// Delete the realm
Realm.deleteRealm(path);
code is not working close is called but not closing the DB any suggestion? cc @nirinchev
Same issue here with Local (non-sync) Realm version 20.0.0. Any idea about the workaround?
What happened?
When calling deleteRealm() after ensuring that the realm is closed (by realm.isClosed), I still get a RealmException:
RealmException: Cannot delete files of an open Realm: '.../6634c5a3b297ab517bc46ad0/default.realm' is still in use.. Error code: 2012.
I just found this tangentially related issue which mentioned waiting or pausing the syncsession - I just wonder why the isClosed property is true then.
I am closing the realm the following way:
Repro steps
Version
3.22.3
What Atlas Services are you using?
Atlas Device Sync
What type of application is this?
Flutter Application
Client OS and version
Android 14
Code snippets
No response
Stacktrace of the exception/crash you're getting
No response
Relevant log output