vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

cpptools-srv2 taking up lots of time.

Open mattijsjanssens opened this issue 3 months ago • 18 comments

Environment

  • OS and Version: macOS Tahoe 26.6.1
  • VS Code Version: 1.133.0
  • C/C++ Extension Version: Microsoft C/C++ DevTools
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary: C++DevTools in vscode seems to use cpptools-srv2 to parse the C++ files? This is already enough to almost hang my machine - has only 16Gb. Would be nice to get some

  • warning about what it will do
  • limit on memory? Limit on number of parallel compilations?

Configuration and Logs

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++14",
            "intelliSenseMode": "macos-clang-arm64"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

mattijsjanssens avatar Aug 19 '26 13:08 mattijsjanssens

I have the same, it's blasting full CPU constantly since an update earlier today.

Image

MarijnKoesen avatar Aug 19 '26 14:08 MarijnKoesen

same issue, until I disabled cpp tools extention

forrestjgq avatar Aug 19 '26 14:08 forrestjgq

The cpptools-srv2 process parses files into the browse database (which supports several features). That behavior has not changed, just moved into a dedicated process (formerly done in the main cpptools process directly). Making full use of the CPU to accomplish that work as quickly as possible, is by-design.

You might try increasing the log level ("C_Cpp.loggingLevel": "Debug"), and monitoring the output, in case you're encountering an issue, such as parsing of files that shouldn't be parsed, following symlinks outside of your project folder, or perhaps repeatedly failing to parse the same file(s). If you're opening a huge repo (or root of an HD), you may want to isolate what is parsed using the browse.path field in a c_cpp_properties.json file, or the C_Cpp.default.browse.path setting.

Colengms avatar Aug 19 '26 20:08 Colengms

The cpptools-srv2 process parses files into the browse database (which supports several features). That behavior has not changed, just moved into a dedicated process (formerly done in the main cpptools process directly). Making full use of the CPU to accomplish that work as quickly as possible, is by-design.

You might try increasing the log level ("C_Cpp.loggingLevel": "Debug"), and monitoring the output, in case you're encountering an issue, such as parsing of files that shouldn't be parsed, following symlinks outside of your project folder, or perhaps repeatedly failing to parse the same file(s). If you're opening a huge repo (or root of an HD), you may want to isolate what is parsed using the browse.path field in a c_cpp_properties.json file, or the C_Cpp.default.browse.path setting.

Problem is: My project is written by Python, it does NOT contain any c/cpp file, as well as CMakeList.txt, after updating to latest vsc, the cpp-tools just consumes too much CPU resource, what does it do? there is no reason I can think of.

forrestjgq avatar Aug 20 '26 03:08 forrestjgq

@forrestjgq We have a potential fix pending for 1.34.0 -- 1.33.8 can try to parse extensionless files when it shouldn't. If you check your logging and see "Parsed file" logging that is most likely the cause.

sean-mcmanus avatar Aug 20 '26 16:08 sean-mcmanus

Image

My CPU usage is horrible.

ItsThareesh avatar Aug 25 '26 07:08 ItsThareesh

@mattijsjanssens @MarijnKoesen @forrestjgq @ItsThareesh We have some fixes in https://github.com/microsoft/vscode-cpptools/releases/tag/v1.34.0 (pre-release). However, depending on what exactly you're hitting, there might still be an "issue". We switched having multiple cpptools-srv2 processes due tag parsing to reduce the wall clock time (matches what VS 2026 does).

sean-mcmanus avatar Aug 26 '26 21:08 sean-mcmanus

Thx @sean-mcmanus , it seems to be in a much better place now. I had uninstalled the plugin because it made my laptop/VSCode unuseable, so I installed 1.34 today.

It started of with a few processes, which I guess is expected, but not as crazy as it used to be:

Image

Now a few minutes later it's settled down to 50% cpu on one core.

It's still a bit weird, because if I check the open files, there aren't any open files (related to my project), yet it constantly still uses between 0.5 and 1 core:

Image

Maybe it's always been like this, I don't know, but at least my laptop is not trying to fly away anymore with all fans on max speed, like it was on 1.33 👍

MarijnKoesen avatar Aug 27 '26 09:08 MarijnKoesen

@MarijnKoesen cpptools shouldn't be constantly using 1 core -- it's possible that it could be responding to something like file watchers. If you set C_Cpp.loggingLeve to the hidden value of "7" you may be able to see logging that shows what is causing the CPU usage and/or you could attach a debugger...however, I believe on mac the debugger attach is disabled due to some mac security feature but there might be some other way to get a perf trace with a call stack: https://github.com/microsoft/vscode-cpptools/wiki/Troubleshooting-Performance-Issues

sean-mcmanus avatar Aug 27 '26 14:08 sean-mcmanus

Yes, something still isn't right, I've removed the plugin again, you can see halfway the graph when I uninstalled it, I wasn't even working on the project that has cpp code.

Image

Anywhere, here are a few traces I did: Image

Image Image

MarijnKoesen avatar Sep 01 '26 15:09 MarijnKoesen

That's on v1.34.2 btw

MarijnKoesen avatar Sep 01 '26 15:09 MarijnKoesen

Update? I mean my WSL always crash because of this extension.

BuriKizilkaya avatar Sep 03 '26 09:09 BuriKizilkaya

I'm seeing nearly the same on Ubuntu v24.04. CPPTools takes up to 80% of CPU while I don't have even one single C file opened in VSCode. VsCode 1.122.1-178

erwango avatar Sep 07 '26 13:09 erwango

@MarijnKoesen Oh, sorry -- I didn't notice your perf log screenshots. We released 1.34.4 with a bunch of fixes, but it sounds like you may still be hitting an issue we don't know about yet. I'll look into that....

sean-mcmanus avatar Sep 09 '26 19:09 sean-mcmanus

@MarijnKoesen Your screenshots are with cpptools and not cpptools-srv2 so I created a new issue at https://github.com/microsoft/vscode-cpptools/issues/14757 .

sean-mcmanus avatar Sep 09 '26 19:09 sean-mcmanus

So I'm closing this issue, but if someone still has an issue with cpptools-srv2, can they file an issue with more repro info?

sean-mcmanus avatar Sep 09 '26 19:09 sean-mcmanus

Marijn Koesen (@MarijnKoesen) We fixed the issue with cpptools shown in your screenshots with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.35.1 -- let us know more info if you or anyone else still hits an issue.

sean-mcmanus avatar Sep 14 '26 23:09 sean-mcmanus

Marijn Koesen (@MarijnKoesen) We fixed the issue with cpptools shown in your screenshots with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.35.1 -- let us know more info if you or anyone else still hits an issue.

Thanks Sean, i've updated to 1.35.1, and so far (5 minutes) I don't see any excessive CPU usage anymore.

So looks like it's fixed. If I see it coming back i'll report back.

Thx for the fix!

MarijnKoesen avatar Sep 15 '26 09:09 MarijnKoesen