Skip to content

Identical cache key hits on ubuntu/mac, but misses on Windows #362

Closed

Description

@mcg1969

In this run I have created a cached asset in the package step with the key package-5fc9dd41a6ade85100c424bab5b08d65d79922d1:

Run actions/cache@v2
  with:
    path: build
    key: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
Cache not found for input keys: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1

Post job cleanup.
/bin/tar --use-compress-program zstd -T0 -cf cache.tzst -P -C /home/runner/work/conda-pack/conda-pack --files-from manifest.txt
Cache saved successfully

All of the MacOS and Linux variants in my tests job successfuly find the cache; e.g. this one:

Run actions/cache@v2
  with:
    path: build
    key: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
Cache Size: ~0 MB (41307 B)
/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/51c1d57a-7530-487c-95ad-4a7fcb4d58cb/cache.tzst -P -C /home/runner/work/conda-pack/conda-pack
Cache restored from key: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1

None of the Windows variants do; e.g., this one:

Run actions/cache@v2
  with:
    path: build
    key: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
Cache not found for input keys: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1

Remember, these are all parallel runs of exactly the same build step. Will try to post some debugging information when I can figure out how to do it.

Activity

  1. mcg1969 commented on Jul 6, 2020

    @mcg1969
    Author

    Updated this run with debugguing information.

    Here's the log for a failed hit:

    ##[debug]Register post job cleanup for action: actions/cache@v2
    ##[debug]Loading inputs
    ##[debug]Evaluating: format('package-{0}', github.sha)
    ##[debug]Evaluating format:
    ##[debug]..Evaluating String:
    ##[debug]..=> 'package-{0}'
    ##[debug]..Evaluating Index:
    ##[debug]....Evaluating github:
    ##[debug]....=> Object
    ##[debug]....Evaluating String:
    ##[debug]....=> 'sha'
    ##[debug]..=> '5fc9dd41a6ade85100c424bab5b08d65d79922d1'
    ##[debug]=> 'package-5fc9dd41a6ade85100c424bab5b08d65d79922d1'
    ##[debug]Result: 'package-5fc9dd41a6ade85100c424bab5b08d65d79922d1'
    ##[debug]Loading env
    Run actions/cache@v2
    ::save-state name=CACHE_KEY::package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
    ##[debug]Save intra-action state CACHE_KEY = package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
    ##[debug]Resolved Keys:
    ##[debug]["package-5fc9dd41a6ade85100c424bab5b08d65d79922d1"]
    ##[debug]Checking tar --version
    ##[debug]bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp
    ##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/SyPiuWRZfZhgosQnlbkVj8WEdMgSzKZ74mqmotYBPmK4Oixovs/_apis/artifactcache/cache?keys=package-5fc9dd41a6ade85100c424bab5b08d65d79922d1&version=f641f16661dc3609f08841cc60405d8625b8976a3c51195cbfa1dcee689de520
    Cache not found for input keys: package-5fc9dd41a6ade85100c424bab5b08d65d79922d1
    ##[debug]Node Action run completed with exit code 0
    ##[debug]Finishing: Retrieve the build artifact cache
    

    Here are the successful Urls from Windows, Linux, and Mac cache attempts, respectively:

    https://artifactcache.actions.githubusercontent.com/SyPiuWRZfZhgosQnlbkVj8WEdMgSzKZ74mqmotYBPmK4Oixovs/_apis/artifactcache/cache?keys=package-5fc9dd41a6ade85100c424bab5b08d65d79922d1&version=f641f16661dc3609f08841cc60405d8625b8976a3c51195cbfa1dcee689de520
    https://artifactcache.actions.githubusercontent.com/SyPiuWRZfZhgosQnlbkVj8WEdMgSzKZ74mqmotYBPmK4Oixovs/_apis/artifactcache/cache?keys=package-5fc9dd41a6ade85100c424bab5b08d65d79922d1&version=d67e0235b9192999f3e9ffe31d1864c1878d3fb9c5da52d2bfc8fc07af8f0e90
    https://artifactcache.actions.githubusercontent.com/SyPiuWRZfZhgosQnlbkVj8WEdMgSzKZ74mqmotYBPmK4Oixovs/_apis/artifactcache/cache?keys=package-5fc9dd41a6ade85100c424bab5b08d65d79922d1&version=d67e0235b9192999f3e9ffe31d1864c1878d3fb9c5da52d2bfc8fc07af8f0e90
    

    As you can see, the keys entry is the same, but the version entry is not.

  2. mcg1969 commented on Jul 6, 2020

    @mcg1969
    Author

    It looks like the version key is a function of the compression program, which differs between Windows and Mac.

  3. mcg1969 commented on Jul 6, 2020

    @mcg1969
    Author

    Looking at the discussion in #301 and also in the README.md about the use of zstd on Linux and macOS, it looks like this is a semi-known issue, but it sure needs to be documented. I don't like hearing sob stories as a developer myself but I've literally spent hours wrestling actions/cache into shape here only to be stopped on the 5 yard line :-( I guess I'll have to use artifact uploads instead for this one. But to be clear—it's not a total sob story; the cache is working great for my OS-dependent artifacts!

  4. milosmns commented on Dec 20, 2020

    @milosmns

    I'm experiencing a similar issue (also working fine on linux/mac and failing to store anything on windows)... https://github.com/milosmns/tema/actions/runs/434017347

    Looks like some folder permission issue... On my side it's a Kotlin/Native showcase project

  5. rikardn commented on Feb 19, 2021

    @rikardn

    I have the same problem in two different workflows. First caching on ubuntu-latest in one job, then using the cache in ubuntu, macos and windows in other jobs. In ubuntu and macos it works fine, but in Windows I get cache not found.

    See my failed runs here: https://github.com/UUPharmacometrics/PsN/runs/1928546379?check_suite_focus=true and here https://github.com/pharmpy/pharmpy/runs/1928367509?check_suite_focus=true

    Let me know if I can assist in resolving this in any way.

  6. mzabaluev commented on Mar 9, 2021

    @mzabaluev

    See here for the explanation: #330 (comment)

  7. github-actions commented on Mar 10, 2022

    @github-actions

    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.

  8. milosmns commented on Mar 10, 2022

    @milosmns

    Is it fixed though?

  9. self-assigned this
    on May 11, 2022
  10. added
    bug
    on Aug 17, 2022
  11. lvpx commented on Sep 7, 2022

    @lvpx
    Contributor

    👋 @milosmns @rikardn @mcg1969 @mzabaluev this behaviour is due to difference in compression algorithms used. Linux and macos use zstd but Windows does not due to issues. We have this documented and also a workaround. Please refer to the documentation to if you want to use cross-os caching with Windows. Closing this issue as it is a duplicate of #888 and has been documented.

  12. assigned and unassigned on Sep 7, 2022
  13. milosmns commented on Sep 7, 2022

    @milosmns

    Hey @pdotl, thanks for getting back to this 🙏

    Since you just mentioned that there's a documented workaround for this problem, is it possible to make that workaround the default behavior? I ask about this because (at least for me) having cross-os support is the default thing I want when building for multiple platforms.

    And if not, it's also ok, but it would be nice to get some reasoning behind the decision if possible 😅

    Thanks!

  14. lvpx commented on Sep 7, 2022

    @lvpx
    Contributor

    @milosmns there were multiple issues with zstd on windows due to which it had to be disabled, causing different cache version on windows. We are looking into restoring the cross-os behaviour as default. Meanwhile, hopefully the workaround helps.

  15. milosmns commented on Sep 7, 2022

    @milosmns

    Awesome, good to know. Cheers.

  16. self-assigned this
    on Nov 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:compressionbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions