microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.5k stars 1.55k forks source link

cpptools-srv stuck at 100% CPU, blocking VScode CoPilot #12750

Open janfeitsma opened 6 days ago

janfeitsma commented 6 days ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

Laptop heats up, fan goes to 100% when using VScode. Inline copilot symbol (yellow stars) disappeared. Process cpptools-srv is at 100% for 30minutes already.

Steps to reproduce: Depends on my codebase / branch. If needed, I can share a link. But I would prefer instead some debug logging / insight which file it is having so much trouble with.

Expected behavior: No laptop overheating. Proper copilot function.

Configuration and Logs

Configurations in c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64"
        }
    ],
    "version": 4
}
-------- Diagnostics - 9/22/2024, 3:05:02 PM
Version: 1.22.4
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/jan/github/MRA-components/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c11",
    "cppStandard": "c++17",
    "intelliSenseMode": "gcc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "myredactedrepo/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.intelliSenseEngine": "Tag Parser",
    "C_Cpp.intelliSenseCacheSize": 0,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.updateChannel": "Insiders"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.inc": "cpp",
        "cctype": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "csetjmp": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "*.ipp": "cpp",
        "any": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "hash_map": "cpp",
        "hash_set": "cpp",
        "strstream": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "cfenv": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "codecvt": "cpp",
        "complex": "cpp",
        "condition_variable": "cpp",
        "cstdint": "cpp",
        "deque": "cpp",
        "forward_list": "cpp",
        "list": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "algorithm": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "map": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "ratio": "cpp",
        "regex": "cpp",
        "set": "cpp",
        "string": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "fstream": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "ostream": "cpp",
        "scoped_allocator": "cpp",
        "shared_mutex": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "streambuf": "cpp",
        "thread": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "valarray": "cpp",
        "variant": "cpp",
        "bit": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.22.4.0
No active translation units.

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 495041
Number of files parsed: 27317


### Other Extensions

_No response_

### Additional context

Tried various settings already. Tried debugger but could not see anything. (May also be my fault for not being expert enough.)
sean-mcmanus commented 5 days ago

With "C_Cpp.intelliSenseEngine": "Tag Parser", set, cpptools-srv is not supposed to be launched. I'm guessing the copilot call back code is not checking for that setting and trying to launch cpptools-srv when it shouldn't. Changing Cpp.intelliSenseEngine to "default" might fix it, not sure yet.

sean-mcmanus commented 5 days ago

I'm not able to repro this. I don't see a cpptools-srv launched when C_Cpp.intelliSenseEngine is "Tag Parser". I'll ask if anyone else on our team is able to repro it.

janfeitsma commented 4 days ago

Thanks Sean.

I kicked out all the custom C_Cpp settings which I gathered over the past weeks trying to debug this specifically:

myrepo/.vscode/settings.json

    "C_Cpp.intelliSenseCacheSize": 0,
    "C_Cpp.intelliSenseUpdateDelay": 300,
    "C_Cpp.intelliSenseEngine": "Tag Parser",
    "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true,
    "C_Cpp.loggingLevel": "Debug"

Had a closer look at the ps tree, I noticed two versions of cpptools running: 1.22.4 and 1.22.3. Now I wonder: maybe cpptools-srv was somehow associated to the older one. So I did a reboot.

Soon after restarting vscode and resuming development, cpptools-srv appeared again. Running 100% CPU for a while. Problem persists.

Maybe relevant to mention I use bazel build. What other info should I provide?