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: image

After: image

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

Most upvoted comments

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

Windows cache restore time before (5m 38s)

After

Windows cache restore time after (1m 46s)

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?

Hi! Yeah, from some quick tests it seems to work better now.

I’m also experiencing this on Node 18.

@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 my actions/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:

image

Without a cache hit, when trying to save the cache, the post-action times out:

image