microsoft / microsoft/vscode-cpptools

Language server crashed

Open
#11,745 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 10, Ubuntu 22.04, WSL 1.2.5 / 2.0.9
  • VS Code Version: 1.84.2
  • C/C++ Extension Version: Tested with 1.18.5 && 1.19.1
  • If using SSH remote, specify OS of remote machine:
Bug Summary and Steps to Reproduce

Bug Summary:

Creating this issue from #10651 discussion.

Company project, private code, complex & huge C++ one.
We get Language Server Crashed. Restarting... in different machines and developers so frequently. This error is easily triggered if we try to execute Show Call Hierarchy, for example, or just hovering in a method name and wait 2-5 minutes. Sometimes we have found that even without doing anything besides opening a file could happen, but not really sure about this last one.

Removing or renaming the c_cpp_properties & reopening the project seems to avoid crashing so easily & frequently.

The file compile_commands.json are huge for all projects in my division: 48MB && ~83000 lines
This file size could trigger other issues, for example is crashing another projects when trying to configure with CMake Tools Extension Issue 3469

  1. Snapshot of things working decently (but some submodules or nested folders seems not working, will be back to this)

imagen

Steps to reproduce:

  1. Snapshot triggering the issue with just hovering in the same function with the c_cpp_properties.json below. In weird ocassions it does not fail, just takes about ~10 minutes and the log shows parsings the files:
Processing folder recursive
Tag parsing file...

imagen

Expected behavior:

  • Language Server works.
  • C/C++ development experience for production & real world projects is neat.
Configuration and Logs
{
            "name": "Linux",
            "includePath": [
                "${default}"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c17",
            "cppStandard": "c++14",
            "intelliSenseMode": "linux-gcc-x64",
            "compileCommands": "${workspaceFolder}/build/Debug/compile_commands.json",
            "configurationProvider": "ms-vscode.cmake-tools"
        }

Enabling output logging to Debug seems to not showing anything meaningful:

    "C_Cpp.loggingLevel": "Debug",
loggingLevel: Debug
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/external/grpc/lfs/tmp/4015002588
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/external/grpc/lfs/tmp/4015002588
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/775123808
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/4188040991
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/775123808
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/4213759766
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/4188040991
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/1524892023
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/4213759766
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/external/grpc/lfs/tmp/3710730601
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/external/grpc/lfs/tmp/3710730601
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/1524892023
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/3147052370
LSP: (received - deferred) cpptools/fileCreated: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/1837593162
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/3147052370
LSP: (received - deferred) cpptools/fileDeleted: file:///home/borjamf/workspace/project/.git/modules/.pro/local_pro/lfs/tmp/1837593162/1837593162
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.19.1
cpptools version (native): 1.19.1.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: (received) cpptools/didChangeCppProperties (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/didChangeCppProperties (id: 2)
Code browsing service initialized
Querying compiler for default C++ language standard using command line: /usr/bin/g++ -x c++ -E -dM /dev/null
Detected language standard version: gnu++17
Querying compiler's default target using command line: "/usr/bin/g++" -dumpmachine
Compiler returned default target value: x86_64-linux-gnu
Compiler query command line: /usr/bin/g++ -std=c++14 -m64 -Wp,-v -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/g++'
Compiler query command line: /usr/bin/g++ -std=c17 -m64 -Wp,-v -E -dM -x c /dev/null
Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/g++'
Other Extensions

No response

Additional context

Cannot reproduce the crash when attaching. It does not stop anywhere, but the extension or process is killed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported c_cpp_properties.json configuration, the 48MB compile_commands.json, and the Debug output while reproducing Show Call Hierarchy or hover-triggered processing. Done means the language server no longer crashes or hangs on the reported project, with logs identifying the relevant failure if the issue persists.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.