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

Package cache locking #44

Closed
baszalmstra opened this issue Feb 7, 2023 · 2 comments
Closed

Package cache locking #44

baszalmstra opened this issue Feb 7, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@baszalmstra
Copy link
Collaborator

baszalmstra commented Feb 7, 2023

Multiple processes are able to write to the package cache at the same time. At this point, they are completely unaware of each other. This could cause problems when multiple processes try to write to the same cache.

To work around this issue we want to introduce file locking. Conda and Mamba both already have a system in place to facilitate this. We should mimic their behavior for compatibility to ensure that when both Rattler and Conda/Mamba write to the cache there are no issues.

@wolfv about the mamba implementation:

The different operating systems (UNIX and Windows) support methods to lock files (e.g. on unix it's fcntl whatever). We started out with the idea of writing the PID of the locking process into the file but that was pretty brittle. We can just rely on the OS to make sure a file is locked or unlocked.

There are a few crates for this but I don't know how good they are.

Network drives don't support file locking so we would need a different solution there.

@baszalmstra baszalmstra added the enhancement New feature or request label Feb 7, 2023
@baszalmstra
Copy link
Collaborator Author

In #55 a lockfile struct was introduced. Maybe we can reuse that here?

@baszalmstra
Copy link
Collaborator Author

We have not really seen any issues with this in over a year. Im going to close this.

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

No branches or pull requests

1 participant