toolkit: @actions/cache not restoring cache, version mismatch?
Describe the bug
We use @actions/cache in a popular setup action. Recently updated the lock file which previously used 3.0.6 without issue. Caches appear to be saved, but they are not restored with restoreCache
.
In the first job run, often the cache was saved. If the next run did not restore it, the run also had the common error:
‘Failed to save: Unable to reserve cache with key <key>, another job may be creating this cache. More details: Cache already exists.’
But, inspecting all the keys, the key of the saved cache from the previous job run is the same as the key it cannot find in the 2nd job run. See https://github.com/MSP-Greg/puma/actions/runs/4452716291/jobs/7820684254#step:3:121
As to versions, first, we updated to current (3.1.2). That did not work with code that worked with 3.0.6. Investigated further:
1st Job Run 2nd Job Run
@actions/cache Ubuntu macOS Windows Ubuntu macOS Windows
3.0.6 ✅ ✅ ✅ ✅ ✅ ✅
3.1.0 ✅ ✅ ❌ ✅ ✅ ✅
3.1.1 ❌ ❌ ❌ ✅ ✅ ✅
3.1.2 ❌ ❌ ❌ ❌ ❌ ❌
3.1.4 ❌ ❌ ❌ ❌ ❌ ❌
As noted above, version 3.1.2 and later never restores a cache. 3.1.1 did not restore a cache on the first, run but did on the second run.
To Reproduce Steps to reproduce the behavior: See https://github.com/MSP-Greg/puma/actions/workflows/actions-cache.yaml. Each run in Puma was done with a corresponding branch in https://github.com/MSP-Greg/setup-ruby that was built with the given @actions/cache version.
Expected behavior Versions after 3.0.6 restore caches.
Screenshots NA
Desktop (please complete the following information): NA
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 31
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Workaround for https://github.com/actions/toolkit/issues/1377 — committed to sorah-rbpkg/actions by azrsh a year ago
- Workaround for https://github.com/actions/toolkit/issues/1377 — committed to sorah-rbpkg/actions by azrsh a year ago
- Merge pull request #4 from sorah-rbpkg/workaround-for-actions-toolkit-issues-1377 Workaround for https://github.com/actions/toolkit/issues/1377 — committed to sorah-rbpkg/actions by azrsh a year ago
- Pin cache action to v3.0.6 for https://github.com/actions/toolkit/issues/1377 workaround — committed to magao-x/MagAOX by joseph-long 9 months ago
- fix: downgrade @actions/cache actions/toolkit#1377 — committed to neodyland/rust-ci by Googlefan256 9 months ago
- Trying to fix issue with restoreCache by pinning it to 3.0.6 until issue get resolved Issue: https://github.com/actions/toolkit/issues/1377 PR: https://github.com/actions/toolkit/pull/1378 — committed to flox/install-flox-action by garbas 8 months ago
It’s quite disappointing such a clear and important issue with an attached PR is not dealt with in a month, GitHub Actions maintainers.
This is now affecting
bahmutov/npm-install
and affected us through a dependabot bump of that action, and then it takes some time to notice the install time in CI has exploded. So I expect soon some more thumbs 😃Same here,
bahmutov/npm-install
started to fail withnpm cache hit undefined
.I’m getting the
npm cache hit undefined
usingbahmutov/npm-install
. But the error at the end of the job says: “Cache already exists”.Sigh, think I just hit this issue as well…
I don’t think that’s particularly fair considering this issue currently has zero upvotes.
See https://github.com/actions/toolkit/pull/1378#issuecomment-1478388929