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

Realm.DeleteRealm() creates lock file if Realm doesn't exist #3563

Closed
peachypixels opened this issue Mar 28, 2024 · 2 comments
Closed

Realm.DeleteRealm() creates lock file if Realm doesn't exist #3563

peachypixels opened this issue Mar 28, 2024 · 2 comments

Comments

@peachypixels
Copy link

peachypixels commented Mar 28, 2024

What happened?

Hello!

Not a big issue, but just noticed that calling Realm.DeleteRealm() on a (non-existent) Realm creates its corresponding lock file.

I understand DeleteRealm() doesn't delete lock files (although unsure why) but it seems strange to create a lock file for a Realm that doesn't exist.

Of course it's easy to work around in the app, but thought I'd raise it anyway.

Hope this helps.

Repro steps

  1. "Test.realm" file does not exist
  2. "Test.realm.lock" file does not exist
  3. Realm.DeleteRealm(config);
  4. "Test.realm.lock" file exists

NOTE: Config points to "Test.realm"

Version

11.7.0

What Atlas Services are you using?

Local Database only

What type of application is this?

Unity

Client OS and version

WIndows 10 (22H2)

Code snippets

No response

Stacktrace of the exception/crash you're getting

No response

Relevant log output

No response

Copy link

sync-by-unito bot commented Mar 28, 2024

➤ PM Bot commented:

Jira ticket: RNET-1129

@nirinchev
Copy link
Member

This is expected - in order to delete the Realm file, we need to acquire multiprocess lock. Unfortunately, acquiring the lock implicitly creates the file. If you want to avoid this, you could check if the file exists before deleting it:

if (File.Exists(config.DatabasePath))
{
    Realm.DeleteRealm(config);
}

@nirinchev nirinchev closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 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

2 participants