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

Duplicated cache due to concurrency #1392

Open
pespinel opened this issue May 2, 2024 · 4 comments
Open

Duplicated cache due to concurrency #1392

pespinel opened this issue May 2, 2024 · 4 comments

Comments

@pespinel
Copy link

pespinel commented May 2, 2024

Misc

When running multiple runs at the same time, the cache is duplicated due to concurrency, even with the same key and for the same branch:

Captura de pantalla 2024-05-02 a las 8 47 11

Version: cache@v4
Step:

    - name: Cache
      uses: actions/cache@v4
      id: cache
      with:
        key: venv-${{ runner.os }}-${{ runner.arch }}-pip-${{ hashFiles(format('acceptance/{0}', inputs.file)) }}
        path: ${{ steps.cache-dir.outputs.dir }}
        restore-keys: ${{ runner.os }}-${{ runner.arch }}-pip-
@moetezch
Copy link

moetezch commented May 8, 2024

I am facing same issue with the following configuration

  uses: actions/cache@v4
        id: node_modules
        with:
          path: |
            **/node_modules
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}
Screenshot 2024-05-08 at 10 19 04

@pespinel
Copy link
Author

pespinel commented May 8, 2024

I am facing same issue with the following configuration

  uses: actions/cache@v4
        id: node_modules
        with:
          path: |
            **/node_modules
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}
Screenshot 2024-05-08 at 10 19 04

You have one for each ref. I think that this is the expected result. The problem is when a cache is duplicated for the same hash and the same ref.

@moetezch
Copy link

I am facing same issue with the following configuration

  uses: actions/cache@v4
        id: node_modules
        with:
          path: |
            **/node_modules
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}-${{ steps.node.outputs.version }}
Screenshot 2024-05-08 at 10 19 04

You have one for each ref. I think that this is the expected result. The problem is when a cache is duplicated for the same hash and the same ref.

Ah sorry you are right, I was expecting the case to be used if the key is same regardless of the ref

@pespinel
Copy link
Author

More examples:

Captura de pantalla 2024-05-20 a las 11 43 50

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