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

Unable to reserve cache with key node-cache-Linux-yarn, another job may be creating this cache #582

Closed
4 of 5 tasks
styfle opened this issue Sep 30, 2022 · 5 comments
Closed
4 of 5 tasks
Assignees
Labels
bug Something isn't working

Comments

@styfle
Copy link

styfle commented Sep 30, 2022

Description:
Seeing this error message in post job cleanup:

Failed to save: Unable to reserve cache with key node-cache-Linux-yarn-f7f2739226834f732cad92bce99b36aaa4e3ee50289107ffba1767a40681556e, another job may be creating this cache. More details: Cache already exists. Scope: refs/pull/897/merge, Key: node-cache-Linux-yarn-f7f2739226834f732cad92bce99b36aaa4e3ee50289107ffba1767a40681556e, Version: 73885106f58cc52a7df9ec4d4a5622a5614813162cb516c759a30af6bf56e6f0

Then the next run says

yarn cache is not found

I believe the issue could be the cache key doesn't include the node-version so two concurrent jobs are trying to write to the same cache.

Action version:
actions/setup-node@v3

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

  • node 14, 16
  • yarn 1

Repro steps:

jobs:
  test:
    name: Node ${{ matrix.node }} and ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        node: [14, 16]
    runs-on: ${{ matrix.os }}
    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node }}
      uses: actions/setup-node@v3
      with:
        cache: yarn
        node-version: ${{ matrix.node }}
        check-latest: true

https://github.com/vercel/ncc/blob/main/.github/workflows/ci.yml

https://github.com/vercel/ncc/actions/runs/3159786768/jobs/5145679888#step:19:7

Expected behavior:
Cache to work

Actual behavior:
Cache fails

@styfle styfle added bug Something isn't working needs triage labels Sep 30, 2022
@styfle
Copy link
Author

styfle commented Sep 30, 2022

PR #583 should fix it

@dmitry-shibanov
Copy link
Contributor

Hello @styfle. Thank you for your report. It's not actually an issue because the cache does not depend on node's version. It was saved in another job. https://github.com/vercel/ncc/actions/runs/3159786768/jobs/5145679984

@dmitry-shibanov
Copy link
Contributor

For now I'm going to close the issue because it works as expected.

@styfle
Copy link
Author

styfle commented Sep 30, 2022

@dmitry-shibanov What about native dependencies? Those don't work properly between different versions of node.

@dmitry-shibanov
Copy link
Contributor

The action does not cache node_modules. It caches global dependencies that is why I think it should work as expected without specifying node version. For me information you can take a look at this pull request: actions/cache#70

@dmitry-shibanov dmitry-shibanov self-assigned this Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants