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

[WebStorm/IntelliJ] Nx console plugin causes high CPU load #2031

Closed
FrancescoBorzi opened this issue Feb 24, 2024 · 24 comments
Closed

[WebStorm/IntelliJ] Nx console plugin causes high CPU load #2031

FrancescoBorzi opened this issue Feb 24, 2024 · 24 comments
Labels
type: bug Something isn't working

Comments

@FrancescoBorzi
Copy link

FrancescoBorzi commented Feb 24, 2024

Current Behavior

  • When the plugin is active, it often spawns a "node" process which will consume a lot of CPU.
  • It seems one "node" process will be spawned per project
  • It happens both on Webstorm and Intellij
  • Even after you close the IDE, the node process will keep running until you either force-quit it or restart the machine

Expected Behavior

This should not happen

Steps to Reproduce

  • Use WebStorm 2023.3.4
  • Install Nx Console 1.18.0 and enable the plugin
  • Observe the high CPU load caused by some node process
  • Not sure if this makes a difference, probably not, but I tried on several Angular-based projects

Failure Logs / Images / Videos

No logs available

Environment

  • macOS 13.6.3
  • Nx Console version: 1.18.0
  • WebStorm version: 2023.3.4
  • (also tried on IntelliJ)
@FrancescoBorzi FrancescoBorzi added the type: bug Something isn't working label Feb 24, 2024
@MaxKless
Copy link
Collaborator

The node process is the nxls which is needed to provide information about nx. It should shut down correctly though, so that's definitely a bug.

@fgloppe-cedreo
Copy link

I have the same thing on Intellij Idea 2023.3.4 / nx-console 1.19 / MacOS 13.6.4 / Node 18

@stefanlivens
Copy link

stefanlivens commented Mar 15, 2024

Same here. MacOS 14.3.1, WebStorm 2023.3.4, nx-console 1.19
Webstorm will consume 1000% cpu.

oh, i just wanted to reproduce it (by activating the plugin), and for kicks i tried the 'File' > 'Repair IDE', clicked trough the steps, and lo and behold. My machine behaves (again)!

@stefanlivens
Copy link

I spoke too soon: the spike is back

%CPU Subsystem

419.8
311.5 <unidentified: DefaultDispatcher-worker->

Basicly it is impossible to work with the plugin active

@MaxKless
Copy link
Collaborator

some fixes for disposing and coroutine mgmt will come with the next release. would be great if you could lmk if that will improve things.

@MaxKless
Copy link
Collaborator

Hey! Can you check out idea.log and paste the contents here?
I have a hunch that this is because something is wrong with file watching in IntelliJ and more files than needed are being picked up.
Would be great if you could provide more info.

@stefanlivens
Copy link

Off course, when i started to prepare to get this log ready by cleaning out the logs, I can't reproduce it anymore.
Also installed the latest version (1.20.0) and the issue is (not) there anymore. Or at least a lot less.

@MaxKless
Copy link
Collaborator

MaxKless commented Apr 2, 2024

Hey! I think this definitely has something to do with file watching in Nx Console. Please check the idea.log contents and be sure to insert #dev.nx.console:trace under Help > Diagnostic Tools > Debug Log Settings.
Are you using yarn pnp by any chance, @FrancescoBorzi @stefanlivens

@FrancescoBorzi
Copy link
Author

Are you using yarn pnp by any chance, @FrancescoBorzi @stefanlivens

No, I'm not

@MaxKless
Copy link
Collaborator

Okay that's good to know, thanks.
Any chance you could provide those logs?

@polyakov84
Copy link

I've got issues with node process CPU sage after closing PyCharm 2024.1. Everything works well before I close the PyCharm. After closing the node process doesn't stop and use 150% of CPU.

M1Pro Macbook

@jaysoo
Copy link
Member

jaysoo commented Apr 30, 2024

@FrancescoBorzi @polyakov84 If you run ps aux | grep node | grep -v grep | grep -e nxls -e daemon what output do you see?

@polyakov84
Copy link

@jaysoo It takes 143% of CPU and will not exit until I kill it.

Screenshot 2024-05-01 at 08 42 55

@jaysoo
Copy link
Member

jaysoo commented May 1, 2024

@polyakov84 When you kill it, did kill work, or did you have to use kill -9? I've seen the nxls process hanging before, trying to reproduce it so we can fix.

@polyakov84
Copy link

@jaysoo kill doesn't kill the process. The process still presents, and it increases CPU usage to 215%.

kill -9 kills process, and there are no node processes after that.

@jaysoo
Copy link
Member

jaysoo commented May 1, 2024

@jaysoo kill doesn't kill the process. The process still presents, and it increases CPU usage to 215%.

kill -9 kills process, and there are no node processes after that.

Thank you, that is consistent with what I observe as well. We'll fix this.

@jaysoo
Copy link
Member

jaysoo commented May 1, 2024

If someone can link a gist of their IDEA log, that could help track down the problem.

Screenshot 2024-05-01 at 3 51 06 PM

@polyakov84
Copy link

@jaysoo I don't have this menu item in PyCharm Pro. I also checked in other menus.

@jaysoo
Copy link
Member

jaysoo commented May 1, 2024

@polyakov84 On MacOS, it'd be at ~/Library/Logs/JetBrains under your IDE folder. For example, for me it is ~/Library/Logs/JetBrains/IntelliJIdea2024.1/idea.log.

For other OS, refer to this guide: https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files

@polyakov84
Copy link

@jaysoo
idea.log_sanitized.zip

@polyakov84
Copy link

@jaysoo Here is an additional log tail from closing PyCharm moment. Maybe it will be helpful.

`2024-05-01 23:46:40,610 [2604912] INFO - #c.i.o.w.i.WindowManagerImpl - === Release(true) frame on closed project ===
2024-05-01 23:46:40,616 [2604918] INFO - #dev.nx.console.nxls.NxlsWrapper - Stopping nxls
2024-05-01 23:46:40,616 [2604918] FINER - #dev.nx.console.nxls.NxlsWrapper - Sending request to nxls: shutdown (null)
2024-05-01 23:46:40,619 [2604921] INFO - #dev.nx.console.nxls.client.NxlsLanguageClient - [Nxls] - 2024-05-01T20:46:40.618Z - Unregistering file watcher

2024-05-01 23:46:40,625 [2604927] INFO - #zielu.gittoolbox.blame.cache.xodus - Deleted 0 expired files
2024-05-01 23:46:40,626 [2604928] INFO - #zielu.gittoolbox.blame.cache.xodus - Deleted 0 expired revisions
2024-05-01 23:46:40,629 [2604931] FINER - #dev.nx.console.nxls.NxlsWrapper - Error from nxls: Request shutdown failed with message: Connection is disposed.
2024-05-01 23:46:40,662 [2604964] INFO - #c.i.u.s.SvgCacheManager - SVG icon cache is closed
2024-05-01 23:46:40,667 [2604969] INFO - #c.i.o.v.i.l.NativeFileWatcherImpl - Watcher terminated with exit code 0
2024-05-01 23:46:40,671 [2604973] INFO - #o.j.i.BuiltInServer - web server stopped
2024-05-01 23:46:40,680 [2604982] INFO - #c.i.u.i.FileBasedIndexImpl - Index dispose started
2024-05-01 23:46:40,717 [2605019] INFO - #c.i.p.s.StubIndexImpl - StubIndexExtension-s were unloaded
2024-05-01 23:46:40,717 [2605019] INFO - #c.i.p.s.SerializationManagerImpl - Start shutting down /Users/.../Library/Caches/JetBrains/PyCharm2024.1/index/rep.names
2024-05-01 23:46:40,718 [2605020] INFO - #c.i.p.s.SerializationManagerImpl - Finished shutting down /Users/.../Library/Caches/JetBrains/PyCharm2024.1/index/rep.names
2024-05-01 23:46:40,719 [2605021] INFO - #c.i.u.i.FileBasedIndexImpl - Index dispose completed in 39ms.
2024-05-01 23:46:40,726 [2605028] INFO - #c.i.o.v.n.p.PersistentFSImpl - VFS dispose started
2024-05-01 23:46:40,728 [2605030] INFO - #c.i.o.v.n.p.FSRecordsImpl - VFS closing
2024-05-01 23:46:40,729 [2605031] INFO - #c.i.o.v.n.p.PersistentFSImpl - VFS dispose completed in 2 ms.
2024-05-01 23:46:40,731 [2605033] INFO - #c.i.o.f.i.FileTypeDetectionService - 21 auto-detected files. Detection took 55 ms
2024-05-01 23:46:40,739 [2605041] INFO - #c.i.p.i.b.AppStarter - ------------------------------------------------------ IDE SHUTDOWN ------------------------------------------------------`

@MaxKless
Copy link
Collaborator

MaxKless commented May 2, 2024

Hey! I just released a new version of IntelliJ for JetBrains, you should see it already.
Can you check whether the issue still persists? We now have an additional check to kill the nxls process if it doesn't shut down by itself after 2 seconds :)

@polyakov84
Copy link

polyakov84 commented May 2, 2024

@MaxKless It's fixed and works well in my case. Thanks.

@MaxKless
Copy link
Collaborator

MaxKless commented May 6, 2024

That's great to hear! I'm closing this issue as resolved.
If you still run into this problem, please let me know and I'll have another look.

@MaxKless MaxKless closed this as completed May 6, 2024
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

6 participants