nx-console
nx-console copied to clipboard
[WebStorm/IntelliJ] Nx console plugin causes high CPU load
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
nodeprocess 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.0and enable the plugin - Observe the high CPU load caused by some
nodeprocess - 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)
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.
I have the same thing on Intellij Idea 2023.3.4 / nx-console 1.19 / MacOS 13.6.4 / Node 18
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)!
I spoke too soon: the spike is back
%CPU Subsystem
419.8 <Process total CPU usage> 311.5 <unidentified: DefaultDispatcher-worker->
Basicly it is impossible to work with the plugin active
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.
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.
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.
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
Are you using yarn pnp by any chance, @FrancescoBorzi @stefanlivens
No, I'm not
Okay that's good to know, thanks. Any chance you could provide those logs?
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
@FrancescoBorzi @polyakov84 If you run ps aux | grep node | grep -v grep | grep -e nxls -e daemon what output do you see?
@jaysoo It takes 143% of CPU and will not exit until I kill it.
@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.
@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
killdoesn't kill the process. The process still presents, and it increases CPU usage to 215%.
kill -9kills process, and there are no node processes after that.
Thank you, that is consistent with what I observe as well. We'll fix this.
If someone can link a gist of their IDEA log, that could help track down the problem.
@jaysoo I don't have this menu item in PyCharm Pro. I also checked in other menus.
@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
@jaysoo idea.log_sanitized.zip
@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 ------------------------------------------------------`
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 :)
@MaxKless It's fixed and works well in my case. Thanks.
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.