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

Make CachedEnvironment robust to concurrent modifications #5503

Closed
charliermarsh opened this issue Jul 27, 2024 · 1 comment · Fixed by #5509
Closed

Make CachedEnvironment robust to concurrent modifications #5503

charliermarsh opened this issue Jul 27, 2024 · 1 comment · Fixed by #5509
Assignees
Labels
bug Something isn't working preview Experimental behavior

Comments

@charliermarsh
Copy link
Member

charliermarsh commented Jul 27, 2024

Right now, it's possible that we'd modify an environment that's in-use by another process.

@charliermarsh charliermarsh added bug Something isn't working preview Experimental behavior labels Jul 27, 2024
@charliermarsh charliermarsh self-assigned this Jul 27, 2024
@charliermarsh
Copy link
Member Author

I think I know what to do here but it's slightly tricky. We might be able to reuse it for tool installs though. We want to create the environment in one location, then relocate it to the final location (probably by symlinking so that it's atomic). But we can't do this naively because we need the interpreter in any installed scripts to use the path of the final location.

charliermarsh added a commit that referenced this issue Jul 29, 2024
…nts (#5509)

## Summary

The idea here is similar to what we do for wheels: we create the
`CachedEnvironment` in the `archive-v0` bucket, then symlink it to its
content-addressed location. This ensures that we can always recreate
these environments without concern for whether anyone else is accessing
them.

Part of the challenge here is that we want the virtual environments to
be relocatable, because we're now building them in one location but
persisting them in another. This requires that we write relative (rather
than absolute) paths to scripts and entrypoints. The main risk with
relocatable virtual environments is that the scripts and entrypoints
_themselves_ are not relocatable, because they use a relative shebang.
But that's fine for cached environments, which are never intended to
leave the cache.

Closes #5503.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant