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

Deleting synchronizd Realms suffer from race conditions and will often fail #1425

Open
cmelchior opened this issue Jun 14, 2023 · 1 comment

Comments

@cmelchior
Copy link
Contributor

E.g this test:

    fun deleteFile_exceptionInsideMutableRealm() = runBlocking {
        try {
            realm.subscriptions.update {
                throw RuntimeException("Boom!")
            }
        } catch (ex: RuntimeException) {
            if (ex.message == "Boom!") {
                realm.close()
                Realm.deleteRealm(config)
            }
        }
        Unit
    }

Due to the async nature of the underlying Sync Client, it might still hold on to resources after the Realm is closed. This will often cause deleteRealm() to fail with with: [RLM_ERR_DELETE_OPENED_REALM]: Cannot delete files of an open Realm

@thiagodelgado111
Copy link

Hi folks! Is there any temporary workaround you'd recommend to solve this? Has this been prioritized by the team? I'd be willing to submit a PR if you could provide me with some pointers

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

No branches or pull requests

2 participants