Repository navigation
Description
On Windows, the cache action hangs for 15+min in the post step before failing with Cannot stat: Invalid argument. It appears to be caught in a symlink cycle, see details below. I have seen this issue consistently for a few weeks on Windows runners, on every run.
The cache action is used for the ~/.cache/pre-commit directory, which contains environments for linter tools managed by pre-commit, in this particular case a node environment for Prettier. The job output suggests that tar.exe runs into a symlink cycle:
Post job cleanup.
C:\windows\System32\tar.exe -cz -f d:/a/_temp/bcdd723a-8b44-4f20-a0cd-40818adf8d6e/cache.tgz -C C:/Users/runneradmin/.cache/pre-commit .
tar.exe: ./repobcgy0yhx/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier/node_env-default/Scripts/node_modules/prettier: Cannot stat: Invalid argument
tar.exe: Error exit delayed from previous errors.
[warning]Tar failed with error: The process 'C:\windows\System32\tar.exe' failed with exit code 1
Inspecting the cache layout locally reveals that prettier is a symlink to the directory three levels up:
$ readlink ~/.cache/pre-commit/repo2c0jl6uh/node_env-default/lib/node_modules/prettier
../../../
$ realpath ~/.cache/pre-commit/repo2c0jl6uh/node_env-default/lib/node_modules/prettier
~/.cache/pre-commit/repo2c0jl6uh(Note that this is on a macOS machine. The directory layout should be similar on Windows, with a Scripts directory instead of lib.)
Could be related to #120
Activity
yajo commentedon Aug 8, 2020
Same here. Just in case it helps, here is the fail log and here is the workflow code.
Disable cache for windows
Disable cache for windows
dhadka commentedon Aug 10, 2020
@yajo I tested with symbolic links and junction points. Symbolic links are handled fine, but junction points create problems for
bsdtar. It looks like the Windows 2019 runners have GNU tar installed as part ofmsys, which can be enabled with:See for example: https://github.com/dhadka/test-tar-symlink/blob/master/.github/workflows/blank.yml
Attempt to enable caching on Windows
Attempt to enable caching on Windows
Attempt to enable caching on Windows
Attempt to enable caching on Windows
yajo commentedon Aug 13, 2020
My workaround in copier-org/copier#251 had to be:
Otherwise all further steps executed with
shell: bashfailed due to usingC:\msys64\usr\bin\bash.exeinstead ofC:\Program Files\Git\bin\bash.EXE.yajo commentedon Oct 12, 2020
That one is deprecated now. Gotta use this syntax:
Update GNU Tar for cache on windows
github-actions commentedon Dec 23, 2021
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.
github-actions commentedon Dec 29, 2021
This issue was closed because it has been inactive for 5 days since being marked as stale.
ci(build): cache bun global package cache instead of node_modules