-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Invalid hashes when running multiple Poetry installs simultaneously #5142
Comments
This can happen if you ^C poetry when it's installing. When you rerun it, it finds the local file in the cache and calculates the hash of the truncated file. Need to download to a . file or .download or something and move it into place to avoid this.
This means copying across file systems which can be expensive. Would be best to use the same dir as where it's being downloaded to make the 'move into place' ~atomic. |
Today I've faced the same problem with poetry 1.1.12 not using parallel installs. |
Removing which file? I have the same issue in a Dockerfile and can't figure out the workaround |
I mean locating broken file in the cache dir and removing it ( |
Same issue, but after interrupting Found Workaround that helps me, inspired by, tested on linux: rm poetry.lock
poetry cache clear . --all
rm -rf "$(poetry env info --path)"
rm -rf "$(poetry config cache-dir)/artifacts"
poetry install Poetry version 1.1.13 |
Same issue when installing |
This PR will resolve this issue: #3301. Looks ready to go. |
|
I've opened PR #6186 to address this issue. |
Hello, I provide another recurrence of the situation that appears in this error. This condition results in the same error When installing a dependency using The Numpy file was only 10% downloaded. When I run it again, poetry hash the incomplete file and the result is Invalid Hashes. I'm sure I already have this situation when I look at the cache directory numpy... The WHL package is only 133KB. So the idea is that in poetry you can download the cache file to the/TMP directory and move it around when it's finished downloading. My Environment:
|
…e cache (#6186) If one poetry installation is writing to the cache while a second installer is attempting to read that cache file, the second installation will fail because the in-flight cache file is invalid while it is still being written to by the first process. This PR resolves this issue by having Poetry write to a temporary file in the cache directory first, and then rename the file after it's written, which is ~atomic. Resolves: #5142 I'm not sure how to test this change, as the conditions which cause this bug to appear are a little hard to reproduce.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Linux (run using Docker)
Poetry version: 1.1.12
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/hopper-signifyd/96e8e36f5c91f7d32e109182b8b7b62a
^(please note that projects are in sibling directories named project_a and project_b)
Issue
When running multiple poetry installs simultaneously with a shared Poetry cache directory, the operation commonly fails with the infamous "invalid hashes" error. This is common in CI and monorepo environments. Here's a sample:
After receiving this error, if I run
find . -name pandas-1.0.5-cp36-cp36m-manylinux1_x86_64.whl
, and then run a checksum on the file, I usually get a SHA256 from the "expected" list in the error message. If I don't get an expected hash, it seems to be related to another poetry install process that's still running and downloading that artifact.My current working theory is something like this:
Is there a way we can fix this so that multiple Poetry projects with a common cache directory can safely run simultaneously on the same machine? My initial proposed solution is to simply update the download process to download artifacts directly to the system's temp directory and only copy them into the cache once the download is complete. That way, all processes either get a cache miss, or a cache hit with a correct checksum.
Thoughts on this?
The text was updated successfully, but these errors were encountered: