Berry: [Bug] CPU Usage when working with workspaces

Created on 30 Jan 2020  路  4Comments  路  Source: yarnpkg/berry

  • [ ] I'd be willing to implement a fix

Describe the bug

Whenever I'm working with yarn workspaces I get very high CPU usage. Even after closing all yarn commands, VSCode, etc. I've tried multiple restarts but it keeps happening. Could this be to do with pnpify?

To Reproduce

Unsure - appears to be whenever working with workspaces. Last came up while testing an empty repo the following issue: https://github.com/yarnpkg/berry/issues/839

Screenshots

CPU is the number after ?

Screenshot 2020-01-29 at 4 18 29 PM

Screenshot 2020-01-29 at 5 22 04 PM

Environment if relevant (please complete the following information):

  • OS: OSX
  • Node version: 13.7.0
  • Yarn version: 2.0.0-rc.27
bug

All 4 comments

I actually had a similar issue on Windows when I was playing with this back in December. On a few occasions closing VSCode wasn't enough. I remember zombie node processes that continued to run.

It seemed to happen consistently when I was editing a package.json and would hit ctrl+space to for the version number lookup like this. When I opened VSCode's process explorer I noticed a ton of CMD executions of NPM.

image

I had done some weird stuff to get prettier working so I have a feeling this is related to #822

@joshmeads @sparebytes Have you tried to regenerate sdk? E.g.:
yarn pnpify --sdk
The yarn v2 does not use in memory node_modules fs (which might be CPU bound) for TypeScript support in the latest editor SDK:
https://github.com/yarnpkg/berry/blob/b0c9d687a783f72161f78a2b4e4b1a516c283171/packages/yarnpkg-pnpify/sources/generateSdk.ts#L11

But if you generated SDK with older pnpify version you will have imports of @yarnpkg/pnpify inside .vscode/pnpify/typescript/lib/tsserver.js which will result in building in-memory node_modules fs and might hit CPU hard (at the moment, I'm working to reduce CPU usage for in-memory node_modules fs).

I've also seen this exact same problem. I can confirm that it disappeared after moving back to yarn v1.

Not sure who's fault it is, probably VSCode, but the same npm view commands were hanging

This was fixed in https://github.com/yarnpkg/berry/pull/800.
Try updating and running yarn pnpify --sdk again

Was this page helpful?
0 / 5 - 0 ratings

Related issues

milichev picture milichev  路  3Comments

bradleyayers picture bradleyayers  路  3Comments

chrisands picture chrisands  路  3Comments

tiansijie picture tiansijie  路  4Comments

Bessonov picture Bessonov  路  4Comments