You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: wrong node version installed when cache is corrupt #541
I'm unsure of the cause, but somehow a version of node has been cached in the wrong directory.
The only way to fix this problem is to delete the cache manually if you have access to the runner.
Action version:
v3
Platform:
Ubuntu
macOS
Windows
Runner type:
Hosted
Self-hosted
Tools version:
Requesting v16.15.1 gave v14.16.1 (requested cache path was correct, but the version of node inside was wrong)
Repro steps:
I do not know how to reproduce this with normal usage, but to test on a self hosted runner, install a version of node into the wrong directory.
Expected behavior:
A version of node requested should be installed
Actual behavior:
A corrupted cached version is provided
Hello @ben-styling. Thank you for your report. Could you please provide simple steps to reproduce the issue or debug logs ? Which version of runner do you use ?
I'm very sorry, but I don't know how to replicate the issue we're having without manually putting the wrong binary in the wrong cache directory.
There are not reproduction steps, but while working on a PR for this, I ran the action on a self-hosted runner to install v16.16.0
Then in _work/_tool/node I copied 16.16.0 to 16.15.1 cp -Ra ./16.16.0 ./16.15.1
When running the action to request v16.15.1, the actual version was 16.16.0.
I'm not sure what you mean when asking which version of runner we use. I know that our runners are x64 linux, but I think once the cache is corrupt, the behaviour is the same on all platforms.
I think these are the logs you're asking for, let me know if not!
Could you please confirm that the version was installed in the wrong directory ? It is an expected behaviour if you put binaries of node16 to node14 directory that it will use node14 binaries and the action won't throw an error. The toolkit/toolcache package does not call the tool's version and rely on SemVer version of directory.
If I understand correctly the initial issue is that node16 was pre-cached to wrong directory by the action.
I can confirm that node14 was installed in a node16 directory.
Yes, the initial issue is that node14 was somehow cached to the wrong directory.
I do not know if it was this action, or another action using the same toolcache that caused this error.
We then updated node-version to node-version: 16.15.1, which was working.
Then 12 days ago (July 8th) the same yaml file (the one above, but with node-version: 16.15.1) was giving us node 14.16.1
This is when we looked into why and found that the action was choosing the correct path /opt/hostedtoolcache/node/16.15.1/x64, but that path had node 14 inside somehow.
We have since updated our yaml to the following:
name: PR
on: pull_request
jobs:
build:
name: Lint and unit-test
runs-on: **
env:
GITHUB_PKG_TOKEN: **
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
check-latest: true
registry-url: https://npm.pkg.github.com/
scope: **
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Debug version
run: node -v && npm -v
- name: Install Dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: **
- name: Lint
run: npm run lint
- name: Test
run: npm run test
This didn't fix the issue, but in nvmrc we just increased the node version to 16.16.0
As this runner is used on several projects across multiple teams, I can't be sure if it was this action that caused a version of node to be placed in the wrong directory.
A colleague of mine has suggested that a runner that's running out of disk space, or a network error could have caused this to happen. I'm struggling to recreate those conditions, though.
Hi @dmitry-shibanov, thank you again for your help with this. After speaking with @vsafonkin, I no longer think this issue is within scope of this project. This is likely an external issue.
Activity
dmitry-shibanov commentedon Jul 12, 2022
Hello @ben-styling. Thank you for your report. Could you please provide simple steps to reproduce the issue or debug logs ? Which version of runner do you use ?
ben-styling commentedon Jul 12, 2022
Hi @dmitry-shibanov, thank you for your reply!
I'm very sorry, but I don't know how to replicate the issue we're having without manually putting the wrong binary in the wrong cache directory.
There are not reproduction steps, but while working on a PR for this, I ran the action on a self-hosted runner to install v16.16.0
Then in
_work/_tool/nodeI copied 16.16.0 to 16.15.1cp -Ra ./16.16.0 ./16.15.1When running the action to request v16.15.1, the actual version was 16.16.0.
I'm not sure what you mean when asking which version of runner we use. I know that our runners are x64 linux, but I think once the cache is corrupt, the behaviour is the same on all platforms.
I think these are the logs you're asking for, let me know if not!
dmitry-shibanov commentedon Jul 12, 2022
Could you please confirm that the version was installed in the wrong directory ? It is an expected behaviour if you put binaries of node16 to node14 directory that it will use node14 binaries and the action won't throw an error. The
toolkit/toolcachepackage does not call the tool's version and rely on SemVer version of directory.If I understand correctly the initial issue is that node16 was pre-cached to wrong directory by the action.
ben-styling commentedon Jul 13, 2022
I can confirm that node14 was installed in a node16 directory.
Yes, the initial issue is that node14 was somehow cached to the wrong directory.
I do not know if it was this action, or another action using the same toolcache that caused this error.
dmitry-shibanov commentedon Jul 15, 2022
Hello @ben-styling. I've tried to reproduce the issue but everything works as expected. Could you please provide yaml in which the issue was caused ?
dmitry-shibanov commentedon Jul 18, 2022
Hello @ben-styling, just a gentle ping.
ben-styling commentedon Jul 20, 2022
Hi there, apologies for my delayed response.
Thank you again for looking into this issue!
Here's what the yaml looked like initially
We then updated
node-versiontonode-version: 16.15.1, which was working.Then 12 days ago (July 8th) the same yaml file (the one above, but with node-version: 16.15.1) was giving us node 14.16.1
This is when we looked into why and found that the action was choosing the correct path
/opt/hostedtoolcache/node/16.15.1/x64, but that path had node 14 inside somehow.We have since updated our yaml to the following:
This didn't fix the issue, but in nvmrc we just increased the node version to 16.16.0
As this runner is used on several projects across multiple teams, I can't be sure if it was this action that caused a version of node to be placed in the wrong directory.
I'm suggesting that this action should check the version of node after a cached version is found and try at least once to correct the cache.
As far as I know there's no way to invalidate this cache unless you have access to the runner, and it seems the cache doesn't have a TTL.
edit:
A colleague of mine has suggested that a runner that's running out of disk space, or a network error could have caused this to happen. I'm struggling to recreate those conditions, though.
ben-styling commentedon Jul 20, 2022
Hi @dmitry-shibanov, thank you again for your help with this. After speaking with @vsafonkin, I no longer think this issue is within scope of this project. This is likely an external issue.
Closing this issue.
chore(deps-dev): bump prettier from 3.0.2 to 3.0.3 (actions#541)