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
Cache misses due to path-based versioning and its normalization #330
Comments
|
Hey @mzabaluev, thanks for spotting this. Can you please enable step debugging, change the key, and re-run the workflow? This will provide some more output so we can see what's going on. |
|
I see that the 'Post Cache cargo registry index' step in the producer job gets to write its cache first: Then the 'Post Cache cargo registry' step allocates at the same resource: There is also intra-action state A consumer job queries and fails with: Then in the 'Post Cache cargo registry' step, it saves a new value: |
|
@mzabaluev I think I see what's going on. @v2 introduced a whereas the If you make the This was intended to prevent a user from changing the path but using the same key, since the existing cache entry (if any) wouldn't have the right content. However, in your particular case where you're just excluding a path, it's less helpful. |
On Linux and Mac it does, on Windows it doesn't: https://github.com/mzabaluev/github-actions-playground/actions/runs/116588403 I'm guessing that CRLF line endings screw up the version hash. |
|
For more fun with cache key normalization across OSes, see actions/runner#498 |
|
Any updates on this? I'm trying to decide which |
|
@mzabaluev I suspect this is the result of #301. There's an issue with Windows bsd tar and zstd causing it to hang, so it falls back to gzip compression. |
|
@mzabaluev I've created this PR to trim any leading and trailing whitespace from the path and restore keys, which would also remove any leftover Windows newline characters ( |
|
@dhadka No, the issue reproduced in that test run is not about |
|
@mzabaluev Agreed. I meant to say that #343 will fix any newline differences in the path which would cause a different version hash, but you'll likely still see Windows creating a different cache because it uses a different compression method. The version hash includes the compression method, but we fall back to using Gzip instead of Zstd on Windows due to bug #301. |
I hope in the end state it would be possible to share cache state no matter which runner created it, with the restore action being able to adapt to a possibly different archival format; or maybe this and other tar-related issues will be solved by settling on a single flavor of tar that works across all OSes. The disparate cache entries for Windows and Unix would increase our cache pressure twofold and duplicate the dependency fetching work for Windows jobs without a good reason for it. |
|
This issue is stale because it has been open for 365 days with no activity. Leave a comment to avoid closing this issue in 5 days. |
|
Yes, we still need tar in the cache action to be fixed. |
|
|
|
I created this repo to illustrate the issue i'm having which is related to this bug. https://github.com/y-nk/cache-in-container/actions/runs/3427866818 The problem being that an action building outside of a container has a certain path, and so that path cannot be restored once inside a container (bc the context of the container is different) |
mzabaluev commentedMay 26, 2020
This run using
actions/cache@v2shows how a cache created by theupdate-depsjob is not hit by the jobs in thetestmatrix that depend onupdate-depsand use the same key. This works inactions/cache@v1, so it looks like a regression to me.What's more peculiar, each of the three
testjobs reported to have successfully stored its cache state under this same key.In the next run, all jobs hit the cache, but which state did they get?
The text was updated successfully, but these errors were encountered: