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

Failed to Restore Cache with zstd: Unsupported Format for a Saved Cache #1555

Open
meisolated opened this issue Feb 16, 2025 · 1 comment
Open

Comments

@meisolated
Copy link

Environment:

  • CI/CD System: Gitea Actions using a custom runner on Docker via Portainer
  • Code Repository: Hosted on Gitea v1.23.3 running on an Ubuntu machine (Proxmox VM)
  • External Cache Server: FalconDev OSS GitHub Actions Cache Server
  • Project Context: Cache issues in the CI/CD pipeline for the project

Issue Description:
I am encountering repeated failures during the cache restoration step in my Gitea Actions workflow. Despite successful cache storage (as indicated by the CI logs), attempts to restore the cache result in errors related to "unsupported format".

Error Logs:
Here are snippets from the CI/CD logs that show both the successful cache save and the failed restore attempts:

Cache Save Log:

[command]/usr/bin/tar --posix -cf cache.tzst --exclude cache.tzst -P -C /workspace/vedus/mlaw-backend --files-from manifest.txt --use-compress-program zstdmt
Cache Size: ~32 MB (33435083 B)
Cache saved successfully
Cache saved with key: linux-bun-cache
✅ Success - Post Restore cache

Cache Restore Log:

Cache Size: ~0 MB (231 B)
[command]/usr/bin/tar -xf /tmp/fe9e3ad9-458c-43d2-9f4b-d24750b2c798/cache.tzst -P -C /workspace/vedus/mlaw-backend --use-compress-program unzstd
zstd: /*stdin*\: unsupported format
/usr/bin/tar: Child returned status 1
/usr/bin/tar: Error is not recoverable: exiting now
::warning::Failed to restore: "/usr/bin/tar" failed with error: The process '/usr/bin/tar' failed with exit code 2
Cache not found for input keys: linux-bun-cache

Workflow Configuration for Cache:

- name: Restore cache
  id: cache-bun
  uses: actions/cache@v4
  with:
    path: |
      ~/.bun/install/cache
      ./node_modules
    key: linux-bun-cache

Steps to Reproduce:

  1. Trigger the GitHub Actions workflow.
  2. Observe the caching step fails during the execution of the restore cache action.

Expected Behavior:
Cache should be restored without any format or decompression errors, utilizing the earlier saved cache to fast-track the build and test processes.

Actual Behavior:
Cache restoration fails owing to an "unsupported format" error from zstd and consequential failures from tar, blocking the utilization of the cached data.

Troubleshooting Done:

  • Checked and confirmed zstd is operational and consistent across environments.
  • Manual decompression tests of cache file mimicking the CI environment.

Request for Assistance:
Could anyone provide insights or suggestions on resolving these decompression issues? It's unclear if this problem stems from how the data is being compressed/stored by our third-party cache server or if it might be a configuration mishap on our end involving zstd and tar.


Attachments:

  • CI/CD complete logs for the cache storage and restoration process.

deploy-test-14.log

@guidodobboletta
Copy link

I'm having a similar issue in which I'm trying to run a job inside a container and if the image doesn't have zstd it works. If it has zstd there's no warning but it fails ?? It doesn't make any sense.

To be clear the cache DOES exist but whenever the image has zstd installed then it can't find the cache even though it's there.

Without zstd on the image:

##[debug]ID=debian
##[debug]Running JavaScript Action with default external tool: node20
##[debug]Cache service version: v2
##[debug]Resolved Keys:
##[debug]["redacted"]
##[debug]Checking zstd --quiet --version
##[debug]Unable to locate executable file: zstd. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
##[debug]
##[debug]zstd version: null
##[debug][Request] GetCacheEntryDownloadURL https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.CacheService/GetCacheEntryDownloadURL
##[debug][Response] - 200
##[debug]Headers: {
##[debug]  "content-length": "469",
##[debug]  "content-type": "application/json",
##[debug]  "date": "Thu, 06 Mar 2025 21:33:56 GMT",
##[debug]  "x-github-backend": "Kubernetes",
##[debug]  "x-github-request-id": "redacted"
##[debug]}
##[debug]Body: {
##[debug]  "ok": true,
##[debug]  "signed_download_url": "redacted",
##[debug]  "matched_key": "redacted"
##[debug]}
Cache hit for: redacted

WITH zstd installed:

##[debug]ID=debian
##[debug]Running JavaScript Action with default external tool: node20
##[debug]Cache service version: v2
##[debug]Resolved Keys:
##[debug]["redacted"]
##[debug]Checking zstd --quiet --version
##[debug]1.4.8
##[debug]zstd version: 1.4.8
##[debug][Request] GetCacheEntryDownloadURL https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.CacheService/GetCacheEntryDownloadURL
##[debug][Response] - 200
##[debug]Headers: {
##[debug]  "content-length": "54",
##[debug]  "content-type": "application/json",
##[debug]  "date": "Thu, 06 Mar 2025 21:30:37 GMT",
##[debug]  "x-github-backend": "Kubernetes",
##[debug]  "x-github-request-id": "redacted"
##[debug]}
##[debug]Body: {
##[debug]  "ok": false,
##[debug]  "signed_download_url": "",
##[debug]  "matched_key": ""
##[debug]}
##[debug]Cache not found for keys: redacted
Cache not found for input keys: redacted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants