Microsoft.VSCode.CPP.Extension.darwin pegging CPU for hours on end
Any reason why this happens? My Mac fan is going all the time while using VSCode and its annoying and hot! Surely IntelliSight (or whatever) doesn't constantly need to scan code?

@antnsi It was fixed in 0.14.6 in January. You could be hitting a new/different bug with the same symptom. I'm not aware of any other users hitting this yet. Can you create a new issue with more repro details, such as what it says when you hover over the database icon in the bottom right? If there's no database icon, does it repro after opening a particular file? Our parser could be stuck in an infinite loop when parsing a particular file or one of it's dependencies. If you could attach a debugger to that process and provide the call stack for the stuck thread (usually the one with a deep call stack with parsing-related functions) that would help.
@sean-mcmanus I'm on macOS 10.13.4 and also have the same problem. I've also read the release notes for the version you said that resolved this issue (v0.14.6) and the only note related to this bug as I can see is:
Add C_Cpp.workspaceParsingPriority setting to enable using less than 100% CPU during parsing of workspace files.
So this sure seems like the same "bug". The issue is not only that this process takes 100% CPU, but each instance also consumes a lot of memory and there are usually 4 - 5 instances of the very same process, and also they are live for a very long time. Steps to reproduce:
- Open a folder containing multiple C++ files with ~2000 lines of code and cpptools extension on
- Add a path to include some library (cryptopp for example) in
c_cpp_properties.json - Quit VSCode
After ~6 hours, there are still instances of the process hogging 100% CPU and ~150MB memory.
I haven't set the
C_Cpp.workspaceParsingPriority.
@1uka We need more info. What version of cpptools are you using? Which process is using 100% CPU? Are you using a recursive includePath (e.g. with **)? What's the status of the database icon in the bottom right when you hover over it?
Does the bug not repro if you don't modify the c_cpp_properties.json?
@sean-mcmanus I am currently on v0.17.1 (which is also the version I was when I first had the problem). The process that is using 100% CPU is Microsoft.VSCode.CPP.Extension.darwin. I am not using a recursive includePath (it is a single folder containing only headers, no subdirectories). When I hover over the database icon (which is not always present in the bottom status bar, I can only see it for a short period just after I open the project), it says: "Discovering files". If I remove the c_cpp_properties.json file, the process is still active after I quit VSCode, but it doesn't spend the same amount of resources (both CPU and memory), so I would say it is the same bug, only with mild consequences.
I would be glad to help you further, just point me to the part of the code that is responsible for the search and inclusion of headers (or whatever part of the code you suspect is relevant to this problem).
@1uka This sounds like https://github.com/Microsoft/vscode-cpptools/issues/1960 . That issue has a vsix with a fix. We're working on getting a fixed release out.
no, #1960 is a Windows-only issue. @1uka, please don't install the vsix from #1960. It won't work on Mac.
@bobbrow @1uka Ah, okay. Can you attach a debugger to the process using lots of CPU and send us the call stack of the threads that appear to be doing work? This sounds like a new issue. Removing the c_cpp_properties.json will cause recursive includes to activate.
@1uka just in case, have you seen https://github.com/Microsoft/vscode-cpptools/issues/1816?
@antnsi I hadn't seen the issue you referred, but by comparing your sample of the process that is causing your issues I think that the cause is slightly different, though it might be somehow related to my problem.
@sean-mcmanus Here is a sample of the process including the call stack. I haven't got the time right now to fire up GDB, if this is not enough info let me know and as soon as I can I will debug thoroughly.
@bobbrow I don't see any thread doing work in those call stacks.
@sean-mcmanus I don't either.
@1uka We have an insiders build you can try which may fix the issue (if it doesn't then it means it's a new bug): https://github.com/Microsoft/vscode-cpptools/releases/tag/v0.17.2-insiders . The official release is planned tomorrow unless we get delayed by finding more bugs.
@sean-mcmanus @bobbrow Can confirm this is back with a vengeance. It seems like a new issue, it only cropped up after having to close my VS code instance, thereby updating to 0.17.1.
Logs are attached. process-sample.txt
@jamesadevine [UPDATE] We just released 0.17.3 -- does it still repro with that? We fixed some known issues which could cause this.
@sean-mcmanus I still have this on 1.17.3 on MacOS 10.13.4, attaching process sample. Sample of Microsoft.VSCode.CPP.Extension.darwin.txt
I've got the same issue i.e. CPU > 100% and never going back down with 0.17.3 running on macOS 10.13.4.
@danengelbrecht-king, thanks for the sample. It looks like it is caused by our new recursive include path feature. We are looking at additional ways to improve this. How big is the folder you opened?
I wouldn't mind so much if the process was spawned at low priority
I have quit it,but it also uses 99% cpu.
@Lingdu0 Can you try 0.17.4?