Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VSCode extension is high on CPU usage #2202

Open
FrikkieSnyman opened this issue Jul 9, 2024 · 17 comments
Open

VSCode extension is high on CPU usage #2202

FrikkieSnyman opened this issue Jul 9, 2024 · 17 comments
Assignees
Labels
type: bug Something isn't working

Comments

@FrikkieSnyman
Copy link

FrikkieSnyman commented Jul 9, 2024

Current Behavior

The VSCode extension for NX Console is utilising >100% CPU, constantly. When investigating what are behind these heavy pids, it is:

  • /extensions/nrwl.angular-console-18.24.1/nxls/main.js
  • /extensions/nrwl.angular-console-18.21.4/nxls/main.js

It also seems that these processes continue to run regardless of killing VSCode or disabling the NX extension.

As a result, this significantly drains battery life when using vsc with the NX console extension.

Expected Behavior

Less CPU usage.

Steps to Reproduce

  • Install NX Console VSCode extension
  • Open directory in VSC that is a NX monorepo

Failure Logs / Images / Videos

CPU usage in Activity Monitor

Screenshot 2024-07-08 at 17 23 17

After killing those processes:

Screenshot 2024-07-09 at 09 04 59

Environment

  • Nx Console version: 18.24.1
  • VSCode version: 1.91.0
  • OSX: Sonoma 14.5
@FrikkieSnyman FrikkieSnyman added the type: bug Something isn't working label Jul 9, 2024
@MaxKless
Copy link
Collaborator

MaxKless commented Jul 9, 2024

Hello!
Thanks for the report. Yes I've seen this too, I think it's an issue that pops up when the process is left running overnight and something happens... I haven't been able to track it down yet.
I will work on a solution asap. Thanks for your patience.

@MaxKless MaxKless self-assigned this Jul 9, 2024
@jasonmacdonald
Copy link

Just to add to this report, I'm also seeing the same issue when left open for a while.

I'm also having it crash the Typescript language server outright a lot. I had to disable the extension entirely.

@MaxKless
Copy link
Collaborator

could you add your nx report and some details about your workspace? size for example.

@jasonmacdonald
Copy link

 NX   Report complete - copy this into the issue template

Node   : 18.20.2
OS     : linux-arm64
yarn   : 1.22.19

nx                 : 19.2.1
@nx/js             : 19.2.1
@nx/jest           : 19.2.1
@nx/linter         : 19.2.1
@nx/eslint         : 19.2.1
@nx/workspace      : 19.2.1
@nx/devkit         : 19.2.1
@nx/eslint-plugin  : 19.2.1
@nx/nest           : 19.2.1
@nx/node           : 19.2.1
@nx/playwright     : 19.2.1
@nx/plugin         : 19.2.1
@nx/react          : 19.2.1
@nrwl/tao          : 19.2.1
@nx/web            : 19.2.1
@nx/webpack        : 19.2.1
nx-cloud           : 19.0.0
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@nx-aws-plugin/nx-aws-cache : 3.2.0
nestjs-prisma               : 0.23.0
---------------------------------------
Local workspace plugins:
         @veeva/nx-plugin

Done in 5.33s.

This is a large repo of about 65 projects

@jani-cs
Copy link

jani-cs commented Jul 25, 2024

I noticed the same issue as @jasonmacdonald explained on my side.
If it helps here is my nx report:

   Node   : 18.19.1
   OS     : darwin-arm64
   npm    : 10.2.4

   nx (global)        : 19.4.2
   nx                 : 17.1.2
   @nx/js             : 17.1.2
   @nx/jest           : 17.1.2
   @nx/linter         : 17.1.2
   @nx/eslint         : 17.1.2
   @nx/workspace      : 17.1.2
   @nx/angular        : 17.1.2
   @nx/cypress        : 17.1.2
   @nx/devkit         : 17.2.0
   @nx/esbuild        : 17.1.2
   @nx/eslint-plugin  : 17.1.2
   @nx/node           : 17.1.2
   @nx/playwright     : 17.2.0
   @nx/plugin         : 17.1.2
   @nx/storybook      : 19.3.2
   @nrwl/tao          : 17.1.2
   @nx/web            : 17.1.2
   @nx/webpack        : 17.1.2
   typescript         : 5.2.2
   ---------------------------------------
   Community plugins:
   @ngrx/component          : 17.0.1
   @ngrx/component-store    : 17.0.1
   @ngrx/effects            : 17.0.1
   @ngrx/router-store       : 17.0.1
   @ngrx/schematics         : 17.0.1
   @ngrx/signals            : 17.0.1
   @ngrx/store              : 17.0.1
   @ngrx/store-devtools     : 17.0.1
   @storybook/angular       : 8.2.2
   @testing-library/angular : 13.4.0
   ng-mocks                 : 14.11.0
   ngx-build-plus           : 17.0.0
   ---------------------------------------

@irfanullahjan
Copy link

I have the same issue. Macbook M1

@jeroenhoebe
Copy link

Having the same issue on a M1 Pro. Plus I notice that when stopping a task the node process in the activity monitor is still left running. Refreshing the workspace does clear them up again.

@duwejeferson
Copy link

Just to add to this report, I'm also seeing the same issue when left open for a while.

I'm also having it crash the Typescript language server outright a lot. I had to disable the extension entirely.

I'm having issues with TS lang server either, always have to disable the extension when finished using it.
Running on a Windows 11 with WSL:

OS: Ubuntu 22.04.4 LTS on Windows 10 x86_64
Kernel: 5.15.153.1-microsoft-standard-WSL2
Uptime: 6 hours, 17 mins
Packages: 582 (dpkg), 6 (snap)
Shell: bash 5.1.16
Terminal: Windows Terminal
CPU: AMD Ryzen 7 5700G with Radeon Graphics (16) @ 3.792GHz
GPU: c9c9:00:00.0 Microsoft Corporation Device 008e
Memory: 3679MiB / 23708MiB

NX Report:

Report complete - copy this into the issue template

Node   : 20.12.2
OS     : linux-x64
pnpm   : 8.15.7

nx                 : 19.4.4
@nx/js             : 19.4.4
@nx/jest           : 19.4.4
@nx/linter         : 19.4.4
@nx/eslint         : 19.4.4
@nx/workspace      : 19.4.4
@nx/angular        : 19.4.4
@nx/devkit         : 19.4.4
@nx/eslint-plugin  : 19.4.4
@nx/nest           : 19.4.4
@nx/node           : 19.4.4
@nx/playwright     : 19.4.4
@nx/plugin         : 19.4.4
@nrwl/tao          : 19.4.4
@nx/web            : 19.4.4
@nx/webpack        : 19.4.4
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/jest/plugin
@nx/playwright/plugin
---------------------------------------
Local workspace plugins:
         @ibs/schematics

About VS Code:

Version: 1.93.1 (system setup)
Commit: 38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40
Date: 2024-09-11T17:20:05.685Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

@MaxKless
Copy link
Collaborator

please double check that you're on the latest nx console version, we've just released some fixes for the ts language server.
If it still happens for you, please create a new issue though, let's keep this one focused on the language server problems

@demirtasdurmus
Copy link

I have the same issue. Macbook M1

Me too. I had to uninstall the extension lately as it slows down the editor.

@MaxKless
Copy link
Collaborator

@demirtasdurmus can you provide some logs from the Nx Language Server outputs? Right now I have little to go on in regards to your issues.

@StringKe
Copy link

StringKe commented Nov 26, 2024

When the process encounters an error such as when I'm modifying project.json because I saved the file it seems that nx reloads the workspace

At this point, nx notifies me that it is duplicating the workspace root registration.

Then I exited the whole vscode and checked the process by ps -ef and found that many of the processes for the graph parameter had not been closed and the vscode plugin that had started the plugin before had not been launched.

 min 500 threds

@MaxKless
Copy link
Collaborator

Can you elaborate what this means?

At this point, nx notifies me that it is duplicating the workspace root registration.

Btw, we just fixed an error with spawning plugin workers in Nx, be sure to update to the latest version :)

@StringKe
Copy link

At this point, nx notifies me that it is duplicating the workspace root registration.

Image

Translation: element with ID @workspace/source has been registered

Image

@StringKe
Copy link

Image

Image

Image

Image

I have updated to the latest version and run it for a while subject to the presence of orphaned processes.

@MaxKless
Copy link
Collaborator

Could you provide some logs and more information?

  • Go to Output -> Nx Console Client and paste what you see there.
  • Run nx report and paste your results
  • What Nx Console version are you on?

Thank you :)

@StringKe
Copy link

StringKe commented Nov 29, 2024

Report Files: https://gist.github.com/StringKe/ccc3a37b58bbdd2954b289b702721563

Plugin Version: v18.31.1
Cursor Info:

Version: 0.43.5
Submit: 1.93.1
Date: 2eaa79a1b14ccff5d1c78a2c358a08be16a8e5a0
Electron: 2024-11-27T09:11:51.854Z
ElectronBuildId: 30.5.1
Chromium: undefined
Node.js: 124.0.6367.243
V8: 20.16.0
OS: 12.4.254.20-electron.0

 NX   Report complete - copy this into the issue template

Node           : 22.5.1
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 1.22.22

nx (global)        : 20.0.5
nx                 : 20.1.3
@nx/js             : 20.1.3
@nx/jest           : 20.1.3
@nx/eslint         : 20.1.3
@nx/workspace      : 20.1.3
@nx/devkit         : 20.1.3
@nx/esbuild        : 20.1.3
@nx/eslint-plugin  : 20.1.3
@nx/nest           : 20.1.3
@nx/next           : 20.1.3
@nx/node           : 20.1.3
@nx/react          : 20.1.3
@nx/rollup         : 20.1.3
@nx/vite           : 20.1.3
@nx/web            : 20.1.3
@nx/webpack        : 20.1.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/next/plugin
@nx/vite/plugin
@nx/rollup/plugin

30/11/24: Some processes started by nx don't seem to be able to exit synchronously with cursor exit.

Nxls Client - idle
Telemetry: production
Nxls Client - idle
Nxls Client - starting
Graph Machine - undefined, {"context":{"state":"init","project":null,"error":null},"event":{"type":"xstate.init"},"self":{"xstate$$type":1,"id":"x:0"},"system":{"_snapshot":{"_scheduledEvents":{}},"scheduler":{},"_clock":{}}}
Graph - init
Nxls Client - running
Enabling TypeScript plugin for workspace /Users/chen/Project/Company/SansoniManagement/workspace
Configuring TypeScript plugin 
Nxls process exited, stopping client.
Nxls Client - stopping
Nxls Client - idle
ps -ef | grep nx
  501  4598     1   0 五02下午 ??       759:52.11 /Users/chen/.local/share/mise/installs/node/22.5.1/bin/node /Users/chen/Project/Company/SansoniManagement/workspace/node_modules/.bin/nx run aic-web:dev:serve
  501 53629 53325   0  4:40下午 ttys010    0:00.00 grep --color=auto nx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants