actions / actions/cache

If a workflow is canceled during cache/restore then cache/save writes a corrupt cache (Windows)

Open
#1,729 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

See https://github.com/agda/agda/actions/runs/22600812056/job/65482024259.
This workflow was canceled during cache/restore, but nevertheless saved the cache in cache/save which is executed always().

Run actions/cache/restore@v5
Cache hit for: cabal.yml-Windows-ghc-9.12.2-cabal-3.16.1.0-a135ab72b208a1f99c97091571421a28209922afd2be2544fe48f46c7d47d74a
Received 38715069 of 38715069 (100.0%), 58.9 MBs/sec
Cache Size: ~37 MB (38715069 B)
"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/35412300-b751-41b2-b55b-d29751c76acc/cache.tzst -P -C D:/a/agda/agda --force-local --use-compress-program "zstd -d"
Error: The operation was canceled.
....
Run actions/cache/save@v5
"C:\Program Files\Git\usr\bin\tar.exe" --posix -cf cache.tzst --exclude cache.tzst -P -C D:/a/agda/agda --files-from manifest.txt --force-local --use-compress-program "zstd -T0"
Sent 34931855 of 34931855 (100.0%), 34.2 MBs/sec
Cache saved with key: cabal.yml-Windows-ghc-9.12.2-cabal-3.16.1.0-a135ab72b208a1f99c97091571421a28209922afd2be2544fe48f46c7d47d74a
Image

Subsequent workflow runs failed due to this corrupt cache:
https://github.com/agda/agda/actions/runs/22600933645/job/65482411063#step:10:24

Run actions/cache/restore@v5
Cache hit for: cabal.yml-Windows-ghc-9.12.2-cabal-3.16.1.0-a135ab72b208a1f99c97091571421a28209922afd2be2544fe48f46c7d47d74a
Received 34931855 of 34931855 (100.0%), 106.8 MBs/sec
Cache Size: ~33 MB (34931855 B)
"C:\Program Files\Git\usr\bin\tar.exe" -xf D:/a/_temp/2c1845a5-74e9-4ad3-a959-dc6dc4fcc884/cache.tzst -P -C D:/a/agda/agda --force-local --use-compress-program "zstd -d"
Cache restored successfully
Cache restored from key: cabal.yml-Windows-ghc-9.12.2-cabal-3.16.1.0-a135ab72b208a1f99c97091571421a28209922afd2be2544fe48f46c7d47d74a

Run # shellcheck disable=SC2086
Build profile: -w ghc-9.12.2 -O0
In order, the following will be built (use -v for more details):
 - text-short-0.1.6.1 (lib) (requires download & build)
 - th-abstraction-0.7.2.0 (lib) (requires download & build)
 - th-compat-0.1.7 (lib) (requires download & build)
 - these-1.2.1 (lib) (requires download & build)
 - time-compat-1.9.9 (lib) (requires download & build)
 - transformers-compat-0.7.2 (lib) (requires download & build)
 - unix-compat-0.7.4.1 (lib) (requires download & build)
 - unordered-containers-0.2.21 (lib) (requires download & build)
 - utf8-string-1.0.2 (lib) (requires download & build)
 - uuid-types-1.0.6 (lib) (requires download & build)
 - vector-stream-0.1.0.1 (lib) (requires download & build)
 - zstd-0.1.3.0 (lib) (requires download & build)
internal error in InstallPlan.completed: not in configured state: Installed generic-deriv_-1.14.7-684fb3507ca8094b57c32c2ff59a2a2da94f22ce
CallStack (from HasCallStack):
  error, called at src\Distribution\Client\InstallPlan.hs:284:3 in cabal-install-3.16.1.0-inplace:Distribution.Client.InstallPlan
  internalError, called at src\Distribution\Client\InstallPlan.hs:748:26 in cabal-install-3.16.1.0-inplace:Distribution.Client.InstallPlan
Error: Process completed with exit code 1.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked workflow logs and compare the cancellation behavior of actions/cache/restore@v5 and actions/cache/save@v5 on Windows. Reproduce a canceled restore, then verify that cache/save does not overwrite the existing cache with incomplete contents and that subsequent runs restore successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.