vetur: High CPU usage from Vetur extension

  • 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: https://github.com/Microsoft/vscode/issues/49883

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 53
  • Comments: 80 (19 by maintainers)

Most upvoted comments

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.

@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).

Please make real profiling instead of complaining.

Complaining on Github issue won’t help us to solve the problem. If you can provide a repository that reproduces the problem, or you can send me a profiling mentioned above, it will be more beneficial for us to spot the performance pitfall.

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.

0.12.5 still has high CPU Usage 👎

There are a few cases where I can reliably repro this. The file watcher is listening into node_modules despite the ignore patterns. Part of the issue is the repeated patterns of node_modules of different form on chokidar causing problems for it, other issue is we didn’t handle the ignore path on Windows correctly.

I have pushed 0.12.2 which temporarily disables this file watcher. So you might be hitting #355 but otherwise all other features should work fine. I’ll fix #355 in another way.

@HerringtonDarkholme I’m looking into using VS Code’s own file watcher like this (in vueMain.ts)

  const clientOptions: LanguageClientOptions = {
    documentSelector,
    synchronize: {
      // the settings to synchronize
      configurationSection: ['vetur', 'emmet', 'html', 'javascript', 'typescript', 'prettier', 'stylusSupremacy'],
      // file events that go to `connection.onDidChangeWatchedFiles`
      fileEvents: vscode.workspace.createFileSystemWatcher('{**/*.js,**/*.ts}')
    },
    initializationOptions: {
      config
    },
    revealOutputChannelOn: RevealOutputChannelOn.Never
  };

VS Code has a complex solution to file watching (C# + nsfw + chokidar) to expose a consistent file-watching API, so I’d prefer using it. This does mean people consuming VLS need to do their own file-watching on ts/js files, but then the responsibility of managing the overhead of file-watching is on them, not us. (If we do find a cross-platform file-watcher that works reasonably well I don’t mind adding it back to VLS). Another motivation for this is now VLS is still tightly coupled with FS access. I’m working on extracting all FS access into using a FileSystemProvider so Vetur can be used on remote file systems or in browser using a virtual FS.

I’m planning to do some refactoring of ServiceHost so it can be accessed by all modes and VLS interface. It’ll do file management for all files (vue/js/ts/css/scss/less).

@kjleitz You are correct the module resolution is not cached and optimized. I opened https://github.com/vuejs/vetur/issues/1286 to work on it but didn’t finish before I went to vacation. I’ll get back to it.

same here vetur 0.14.5

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

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

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

@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

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

Worked for me also with 0.12.3.

I had to downgrade to 0.11.7 to stop increasing CPU consumption.

Same for me, upgrading to 0.12.2 boosts VSCode CPU use. Reverted to 0.11.7 again.

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