setup-node: Slow post-action after v4
Description:
The post-action step for this action seems to have become much slower after version 4.0.0 was released.
In the two included images, the only major difference should be the version of actions/setup-node
.
Before:
After:
Action version:
Using actions/setup-node@v4
15 hours after 4.0.0 was released.
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
Node 18.18.2, and Yarn@4.0.0
.
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Reactions: 35
- Comments: 18 (4 by maintainers)
Commits related to this issue
- revert setup-node action to v3 because of slow post action step see issue: https://github.com/actions/setup-node/issues/878 — committed to sitek94/pnpm-monorepo by sitek94 7 months ago
- revert setup-node action to v3 because of slow post action step see issue: https://github.com/actions/setup-node/issues/878 — committed to sitek94/pnpm-monorepo by sitek94 7 months ago
- fix build scripts; update gh workflow (#3) * revert setup-node action to v3 because of slow post action step see issue: https://github.com/actions/setup-node/issues/878 * fix build commands — committed to sitek94/pnpm-monorepo by sitek94 7 months ago
- Explicitly exit the process to not wait for hanging promises See https://github.com/actions/setup-node/issues/878 — committed to xiniria/setup-node by xiniria 7 months ago
- Explicitly exit the process to not wait for hanging promises See https://github.com/actions/setup-node/issues/878 — committed to xiniria/setup-node by xiniria 7 months ago
- ci: test actions/setup-node@man See https://github.com/actions/setup-node/issues/878#issuecomment-1853764840. — committed to uncenter/uncenter.dev by uncenter 7 months ago
- Test fix to `actions/setup-node` https://github.com/actions/setup-node/issues/878#issuecomment-1853764840 — committed to alphagov/govuk-frontend by colinrotherham 7 months ago
@nikolai-laevskii I opened a PR in #907 that applies the same fix as https://github.com/ruby/setup-ruby (issue https://github.com/ruby/setup-ruby/issues/543, PR https://github.com/ruby/setup-ruby/pull/546), could you take a look at it?
And here’s the fix: https://github.com/ruby/setup-ruby/commit/036ef458ddccddb148a2b9fb67e95a22fdbf728b that should probably be ported to setup-node
Same here in multiple projects using JS with Yarn. The
Post Setup Node.js
job slows down from a few seconds to about 2:20 minutes after upgrading to v4.It seems to me that this only happens when JS dependencies have been updated. Re-running the job (which causes a cache hit) is fast again - perhaps because the cache doesn’t need to be saved.
My conclusion: Saving the cache is significantly slower with v4 than with v3.
Hello everyone. We’ve merged the fix for the issue. Could you please try to use
actions/setup-node@main
to confirm that it works as expected?Thank you for detailed description of the issue! We’ll investigate it and come back with details.
Hello everyone. We released the changes yesterday.
For now I am going to close the issue. If you have any concerns feel free to ping us.
@dmitry-shibanov Just confirming that the fix has worked for us too
We only really noticed it on Windows where all those tiny
node_modules
really affect performance:Before
After
Hi! Yeah, from some quick tests it seems to work better now.
@nrutman Actually this issue does not depend on the Node version you’re using, but rather the Node version that the GitHub Action runner uses itself (in this case, the runner for
@actions/http-client
, used by@actions/cache
, itself used by@actions/setup-node
). We have no control over this other than downgrading to v3 of the action.See https://github.com/ruby/setup-ruby/issues/543 which explains a possible cause and fix.
Noticing this as well because I have an aggressive
timeout-minutes: 1
on myactions/setup-node
step, which is now causing many of my builds to fail.I concur with @ledermann that the issue is somewhere in cache-saving.
With a cache hit, the post-action takes
0s
as expected:Without a cache hit, when trying to save the cache, the post-action times out: