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

High CPU usage from Vetur extension #789

Closed
3 tasks done
emertechie opened this issue May 15, 2018 · 80 comments
Closed
3 tasks done

High CPU usage from Vetur extension #789

emertechie opened this issue May 15, 2018 · 80 comments

Comments

@emertechie
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: macOS
  • Vetur version: 0.12.1
  • VS Code version: 1.23.1

Problem

CPU usage is excessively high from the "Code Helper" process. Grabbing the pid from running top and using ps aux | grep 1234, I can see the process is pointing to vetur extension.

image

image

I see someone else has reported something similar here: microsoft/vscode#49883

@erodri
Copy link

erodri commented May 15, 2018

Downgrading the vetur extension to v0.11.7 seems to fix the issue for me.

@squalsoft
Copy link

@erodri How to downgrade extension?

@prine
Copy link

prine commented May 15, 2018

I have the same issue. It uses up to 200% CPU on my Mac OS X High Sierra 10.13.4.
Thanks for the great work btw!

@squalsoft You can go to the releases in the github project and donwload the vsix file. Then you can manually install it in the market place. See the instructions underneath.

image

But somehow v0.11.8 is also broken. @erodri Where did you get the v0.11.7 vsix file?

@cvharris
Copy link

This happened for me after both upgrading Vetur and taking the latest VSCode Insiders. I disabled the extension and reenabled it, seemed to kick it back into normal mode. Not sure if it's just a matter of time before it heats up again.

@jtr109
Copy link

jtr109 commented May 15, 2018

Same issue for me. 😢

@erodri
Copy link

erodri commented May 15, 2018

@squalsoft @prine I used this tutorial to build the link for the previous vetur extension builds.

For example, the link to v0.11.7 is this: https://octref.gallery.vsassets.io/_apis/public/gallery/publisher/octref/extension/vetur/0.11.7/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage

Save it with .vsix extension and install as explained in the tutorial (I just installed it over the current 0.12.1 version).

@cannap
Copy link

cannap commented May 15, 2018

i am not sure but i think its related to #774 i think the watcher watches also whole node_modules folder or something like that

@n0m4dz
Copy link

n0m4dz commented May 15, 2018

Same issue here. I have downgraded to previous version (0.11.7 as @erodri suggested). And it became normal. Hope this issue will be solved asap.

@jtr109
Copy link

jtr109 commented May 16, 2018

The suggestion from @erodri works for me.

By the way, don't forget to disable auto updating extension, otherwise the vetur will be updated to 0.12.1 again.

@Deguang
Copy link

Deguang commented May 16, 2018

Same issue. After downgrade to 0.11.7 , cpu usage calm down.

@HerringtonDarkholme
Copy link
Member

This is probably caused by chokidar file watcher.

Can any one give a reproduction code repo? It will be very helpful.

@kwando
Copy link

kwando commented May 16, 2018

I have this issue also.

@kwando
Copy link

kwando commented May 16, 2018

Installing 0.11.7 as suggested works for me too.

@adrianthedev
Copy link

@iamanders
Copy link

Having the same problem since today. @cvharris disable-enable solution did not work for me.

@mgmgpyaesonewin
Copy link

mgmgpyaesonewin commented May 16, 2018

I am having the same issue. If I type,

ps aux | grep 11480
pyaesone         11480 154.5  3.5  3413096 296540   ??  R     2:53PM   0:54.45 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper /Users/pyaesone/.vscode/extensions/octref.vetur-0.12.1/node_modules/vscode-languageclient/lib/utils/electronForkStart /Users/pyaesone/.vscode/extensions/octref.vetur-0.12.1/server/dist/vueServerMain.js --node-ipc --clientProcessId=11477
pyaesone         11844   0.0  0.0  2432804   1968 s002  S+    2:53PM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn 11480

It is showing that CPU usage is over 150%

@sbstnplcn
Copy link

Same issue for me.
another solution is plan instead of downgrade the extension ?
VS refuse to downgrade it because other extensions depends on it... :(

@luozhihua
Copy link

luozhihua commented May 16, 2018

Downgrade is only temporary, when VS reload or reopen, Vetur will update to latest automatically.

before downgrade, must set extensions.autoUpdate": true to false

@HerringtonDarkholme
Copy link
Member

I cannot reproduce the problem in https://github.com/bailicangdu/vue2-elm

Can any one give me a GitHub repository where the problem appear.

Or your environment if you can reproduce the problem in https://github.com/bailicangdu/vue2-elm ?

@DotCoyote
Copy link

DotCoyote commented May 16, 2018

The Problem has nothing to do with the code you are writing, but the latest releases of VSCode and Vetur...

Environment for me is:

MacOS 10.13.4
VSCode 1.23.1
Vetur 0.12.1

@HerringtonDarkholme
Copy link
Member

@CinKon Please tell me your environment.

screen shot 2018-05-16 at 6 40 09 pm

@ch-lukas
Copy link

Same here !!! Cpu usage is going crazy since this release.

@DotCoyote
Copy link

DotCoyote commented May 16, 2018

bildschirmfoto-2018-05-16-um-12 43 11

@Deguang
Copy link

Deguang commented May 16, 2018

Use VSCoe to open vue2-ele with the latest releases of vetur is fine..... but when i open any .vue file of our private project,cpu usage over 200% 😢。。

@luozhihua
Copy link

image

When open any *.vue files, cup usage of electron_node vueServerMain.js is over 140% quickly.

image

@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented May 16, 2018

@DotCoyote
Copy link

Nope, with vue-elm everything is fine...
Then the problem might be some lint-modules or something else... All my Projects use ESLint and Prettier...

@Deguang
Copy link

Deguang commented May 16, 2018

After installed dependencies of vue2-elm , reboot vscode ,open some .vue file
image

@ricardovegamx
Copy link

Same for me on MacOS Sierra 10.13.4 + Vetur 0.12.2 = high CPU consumption.

@BasitAli
Copy link

I had this as well when I installed 0.12.1 directly from github (before it was updated in VS Code extensions). Love the fact that it fixes the Go to definition feature. Hate to see it causing this problem.

@octref
Copy link
Member

octref commented May 17, 2018

Didn't handle chokidar correctly in 0.12.2. 0.12.3 completely removes chokidar so the problem should be gone. If not, then that's not the file watcher causing the problem.

Would appreciate it if you can confirm 0.12.3 is working for you.

@octref octref closed this as completed May 17, 2018
@Deguang
Copy link

Deguang commented May 17, 2018

@octref Fixed~! Thanks for your working~
image

@faisalraja
Copy link

Worked for me also with 0.12.3.

@mikerockett
Copy link

Yeah that seems to have done it. 👍

@erodri
Copy link

erodri commented May 18, 2018

Yep, 0.12.3 seems to fix the high CPU usage, thanks!

@prine
Copy link

prine commented May 18, 2018

Yeah, looks like it's fixed with 0.12.3 👌
Thanks a lot for the fix and keep up the good work!

@squalsoft
Copy link

Yeah! It's ok. 0.12.3 Fixes this issue.

@mgmgpyaesonewin
Copy link

Yay, what a relief!!! Thx.

@LuisHCK
Copy link

LuisHCK commented Jul 30, 2018

0.12.5 still has high CPU Usage 👎

@octref
Copy link
Member

octref commented Aug 1, 2018

@LuisHCK Would be helpful if you can provide the sample project you are working on, and info such as system spec, OS, node version etc.

@rabelais88
Copy link

@octref my CPU went full load while working under this condition:
Node: 8.11.3
VSCode: 1.25.1
Vetur: 0.12.6
MacOSX: 10.13.6(High Sierra)
Happened while working on vue-cli v3.0.0 rc3 project, when I changed the current date of MacOSX to 3~4 days earlier than the real date, in order to test user date related problems. VSCode helper took up most of the load but not really sure if it's due to Vetur or other extensions.

@octref
Copy link
Member

octref commented Aug 13, 2018

@rabelais88 Try Help -> Process Explorer, and see if Vetur is the issue:

image

@patzick
Copy link

patzick commented Nov 3, 2018

@octref it appears that problem has unfortunately returned.
Code version: 1.28.2
Vetur version: 0.13.0

screen shot 2018-11-03 at 16 46 22

@octref
Copy link
Member

octref commented Nov 20, 2018

@patzick Please open a new issue. Also, is it possible for me to get a repro case? Can you modify https://github.com/octref/veturpack to repro the issue?
Also how large is your project?

@patzick
Copy link

patzick commented Nov 21, 2018

@octref problem has disappeared after two days, i don't know why but it's okey now. Thank you, vetur is great! :)

@CaptainMack
Copy link

CaptainMack commented Nov 29, 2018

I am having same problem, Code Helper running 100% using

ps aux | grep <Code Helper PID>

I get the following:

Helper.app/Contents/MacOS/Code Helper /Users/Name/.vscode/extensions/octref.vetur-0.14.2/server/dist/vueServerMain.js --node-ipc --clientProcessId=16278

vetur version 0.14.2

@MatanYadaev
Copy link

same here vetur 0.14.5

@marvinside
Copy link

Not sure if this is the same bug or a different one as this Issue is mostly affecting OSX users.

After having VS-Code running for 1-2 Days, the reaction time as i type gets pretty bad. Sometimes it takes 1-2 seconds till the pressed character appears in VS-Code.

I noticed high CPU usage of Vetur as i type, mostly peaking at 90% CPU.
After restarting VS-Code, the Problem is fixed. Maybe it's a MemoryLeak, also wondering why vs-code's bootstrap-fork process is having 190G of virtual memory...

bildschirmfoto von 2019-02-09 15-34-49

@octref
Copy link
Member

octref commented Feb 9, 2019

@marvinside That's actually a problem of VS Code, not Vetur. I created an issue on VS Code side: microsoft/vscode#68322. It would be great if you can follow up with some more details so we can fix it. Thanks!

@marvinside
Copy link

marvinside commented Feb 11, 2019

@octref I'm not sure if this is the problem, as the bootstrap-fork process has not gotten any CPU usage while VS-Code slows down.

@vividvilla
Copy link

VSCode is literally unusable for Vue project in macOS because of this bug.

@octref
Copy link
Member

octref commented May 23, 2019

@kjleitz
Copy link

kjleitz commented Aug 2, 2019

@octref Just a stab in the dark:

Could this be related to the problems which precipitated ForkTsCheckerWebpackPlugin? Obviously this issue is unrelated to webpack, but we ended up switching to the fork-ts-checker-webpack-plugin a while ago because our builds were taking > 15 minutes and it reduced them to < 4 minutes. IIRC it was because the type checking service was being restarted for each SFC that the Vue template compiler consumed, and had to walk the import tree separately for every single SFC and wasn't caching the hits between runs, so it had to hit the filesystem repeatedly for module resolutions.

I don't know the specifics or internals of VSCode's file watching service, or of Vetur itself, but as the project gained more files (especially more entry points/"close to root level" components) the compilation time (and type checking) took longer and longer because the compilation of the SFCs were spawning a huge redundancy in file reads. That seems to also be the case (in my experience) with this Vetur issue, as it doesn't have nearly the same slowdown in a small project as it does in a moderately larger project.

Could it be the same root cause? And would a similar strategy (forking the type checking service or other module-resolving services into their own thread/process so they can take advantage of caching between runs) possibly mitigate the issue?

@octref
Copy link
Member

octref commented Aug 7, 2019

@kjleitz You are correct the module resolution is not cached and optimized. I opened #1286 to work on it but didn't finish before I went to vacation. I'll get back to it.

@kjleitz
Copy link

kjleitz commented Aug 8, 2019

@octref 😍 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests