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

Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin keeps consuming a core

Open dirkvdb opened this issue 9 years ago • 13 comments

OS: MacOS Sierra 10.12.6 VSCode: 1.15.1 CppTools: 0.12.3

When I open my project in vscode the intellisense process starts using all the cpu and never stops. Even if I leave it running for hours. The little red flame in the bottom right says "Parsing..." Hovering over a symbol says: "Loading..."

But it never exits this state. If I shutdown vscode the Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin process keeps running and consuming a core until I do a Force quit.

Below is my config and I also attached a sample of the intellisense process. If you need more info the issue is 100% reproducible, so just let me know.

{
    "configurations": [
        {
            "name": "Mac",
            "includePath": [
                "${workspaceRoot}",
                "${workspaceRoot}/modules/upnp/inc",
                "${workspaceRoot}/modules/utils/inc",
                "${workspaceRoot}/modules/audio/inc",
                "${workspaceRoot}/build/local-clang4/include",
                "${workspaceRoot}/modules/image/inc",
                "/usr/include",
                "/usr/local/include",
                "/usr/local/include/c++/v1",
                "/usr/include/machine"
            ],
            "browse": {
                "path": [
                    "${workspaceRoot}/modules/upnp/inc",
                    "${workspaceRoot}/modules/utils/inc",
                    "${workspaceRoot}/modules/audio/inc",
                    "${workspaceRoot}/build/local-clang4/include",
                    "${workspaceRoot}/modules/image/inc",
                    "/usr/include",
                    "/usr/local/include",
                    "/usr/local/include/c++/v1"
                ]
            },
            "intelliSenseMode": "clang-x64"
        }
}

Sample of Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin.txt

dirkvdb avatar Aug 20 '17 07:08 dirkvdb

I am suffering the same issue. Sometimes it takes nearly 400% CPU......See below. 29738906-e9e3820c-8a62-11e7-8287-b130afcf09b3

VSCode Version: 1.15.1 OS Version: macOS 10.12.6

Only C/C++ tools and C++ intellisence extension installed.

ghost avatar Aug 27 '17 14:08 ghost

Are either of you able to share a project or code file that reproduces this error? All I can tell from the sample is that the IntelliSense engine is parsing the file.

bobbrow avatar Aug 29 '17 04:08 bobbrow

Encountered the same problem just now while exploring the flexible array member feature in C struct. OS: MacOS 10.12.6 VSCode: 1.15.1 C/C++ Plugin: 0.12.3

After tried a while, narrowed down the problem to be occurring with below code:

#include <stdio.h>

typedef struct Pixel {
    int r;
    int g;
    int b;
} px;

typedef struct Matrix {
    int width;
    int height;
    px pixel[][];
} matrix;

int main(int argc, char *argv[])
{
    return 0;
}

the line px pixel[][] triggers the issue. (I know it's not legitimate now as the clang will throw error about it.) Hope this info could do some help with the investigation.

heraclitusq avatar Aug 29 '17 08:08 heraclitusq

To reproduce it with my project:

git clone --recursive https://github.com/dirkvdb/doozy
cd ./doozy && ./bootstrap.sh native && code .

Then Cmd+p and open upnp.http.functions.cpp

The bootstrap script will take a while as it sets up all the project dependencies (ffmpeg, libpng, libjpeg, boost, ... ) but is necessary as it puts all the third party headers in place.

This does require cmake, autotools, yasm, a working compiler, ... in order for the bootstrap to succeed

dirkvdb avatar Aug 29 '17 20:08 dirkvdb

In my case, reproduce as follows:

  1. git clone https://github.com/virgo-coder/EdgeDrawing
  2. Open EdgeDrawing directory in VSCode
  3. Add include path "${workspaceRoot}/include", it looks like this
"configurations": [
        {
            "name": "Mac",
            "includePath": [
                "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
                "/usr/local/include",
                "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include",
                "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
                "/usr/include",
                "/usr/include/machine",
                "${workspaceRoot}", 
                "${workspaceRoot}/include"
            ],
            "defines": [],
            "intelliSenseMode": "clang-x64",
            "browse": {
                "path": [
                    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1",
                    "/usr/local/include",
                    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include",
                    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
                    "/usr/include",
                    "/usr/include/machine",
                    "${workspaceRoot}", 
                    "${workspaceRoot}/include"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        },
  1. open examples/example.cpp, it always says "loading" when I point to any symbol. At the same time, Microsoft.VSCode.CPP.IntelliSense.Msvc.darwin keeps consuming a core.

OS Version: macOS 10.12.6 VSCode Version: 1.15.1 C/C++: 0.12.3 C++ Intellisense: 0.2.2

ghost avatar Aug 30 '17 15:08 ghost

Thanks everyone! I'll take a look at these samples.

bobbrow avatar Aug 30 '17 15:08 bobbrow

@heraclitusq, the code you posted results in an infinite loop in the front end compiler. I passed your case on to the compiler team.

@dirkvdb and @virgo-coder, I can reproduce your issues as well, but haven't determined the root cause yet.

bobbrow avatar Aug 30 '17 17:08 bobbrow

Thanks @bobbrow .

heraclitusq avatar Aug 31 '17 01:08 heraclitusq

@dirkvdb and @virgo-coder, your cases are the same bug, but a different infinite loop than @heraclitusq. I am passing your issue over to the compiler team as well.

bobbrow avatar Aug 31 '17 02:08 bobbrow

@bobbrow Thanks :)

ghost avatar Aug 31 '17 03:08 ghost

👍 on this issue. Unfortunately i have to defer to a different IDE :-(

seryoni avatar Sep 27 '17 09:09 seryoni

0.13.1 has a patch for the issues reported in this thread until I get a proper fix from the compiler team. I force IntelliSense to exit parsing when the conditions are detected which means you will get incomplete/incorrect IntelliSense for the affected translation units, but we no longer get stuck in an infinite loop.

bobbrow avatar Oct 05 '17 21:10 bobbrow

Thanks!

dirkvdb avatar Oct 06 '17 06:10 dirkvdb