Cache miss even tho key exists
See original GitHub issueWe’re using actions/cache@v3
in self-hosted runners (ubuntu-based).
We get a cache hit in one branch:
Cache restored successfully
Cache restored from key: v16.15.0-nodemodules-91bd5669329abf8e285e2b706e76bc9787848689b31ec5755f991616af28e407
Then, roughly an hour later, in a different branch (same workflow), we get a cache miss for the same key:
Cache not found for input keys: v16.15.0-nodemodules-91bd5669329abf8e285e2b706e76bc9787848689b31ec5755f991616af28e407
Why?
No other workflow runs took place between them.
This is the action we’re using:
name: 'Install Node dependencies'
description: 'Install Node dependencies'
author: 'proxyco'
inputs:
path:
default: '.'
description: 'Location of node_modules'
required: false
node-version:
description: 'The Node version'
required: true
runs:
using: "composite"
steps:
- name: Cache node_modules
id: node-modules
uses: actions/cache@v3
with:
path: ${{ inputs.path }}/node_modules
key: ${{ inputs.node-version }}-nodemodules-${{ hashFiles(format('{0}/package-lock.json', inputs.path)) }}
- name: Install dependencies
if: steps.node-modules.outputs.cache-hit != 'true'
# Skip post-install scripts here, as a malicious
# script could steal NODE_AUTH_TOKEN.
run: npm ci --ignore-scripts
shell: bash
working-directory: ${{ inputs.path }}
usage:
- name: Set Node version
run: echo ::set-output name=NODE_VERSION::$(node --version)
id: nvm
- name: Install dependencies
uses: ./.github/actions/npm-install
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Cache miss is fired if Cache::has($key) returns false #12474
As for me, Cache miss means if a key exist on the server and was stored previously but retrieved value is null for...
Read more >How is it possible that a key exists in cache but cannot be ...
Infinispan uses hashCode() to determine the segment (and owners) of a key. Internally, the data is stored in a ConcurrentHashMap . My guess...
Read more >Cache miss attack - by Alex Xu - ByteByteGo Newsletter
If the key exists, the request first goes to the cache and then queries the database if needed. If the key doesn't exist...
Read more >Alex Xu on Twitter: " Using Bloom filter. If the key exists, the ...
One of the issues is cache miss attack. Correct me if ... If the key exists, the request first goes to the cache...
Read more >Create a disk cache object — diskCache - R Shiny
The missing and exec_missing parameters controls what happens when get() is called with a key that is not in the cache (a cache...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@BeyondEvil Yes, this is expected. You will get a cache miss on a different branch if the cache save happened on a different branch with the same key, unless the save happens in the main/master branch, in which case all the other branches can access it. Please let me know if you have any more questions.
Not a good feature. It is undermining GitHub’s biggest feature which is making a pull request.
https://github.com/actions/cache/issues/79#issuecomment-1204808650