microsoft / vscode-cpptools

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

Language server crashed #11745

Open borjamunozf opened 10 months ago

borjamunozf commented 10 months ago

Environment

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:

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.

sean-mcmanus commented 10 months ago

@borjamunozf What does the debug console logging say when "extension or process is killed" -- i.e. what is the signal message that is causing the process to exit? Also, without hitting the crash, are you able to attach and break into the debugger for the cpptools process?

borjamunozf commented 10 months ago

@borjamunozf What does the debug console logging say when "extension or process is killed" -- i.e. what is the signal message that is causing the process to exit? Also, without hitting the crash, are you able to attach and break into the debugger for the cpptools process?

[Detaching after fork from child process 3689692]
[Detaching after fork from child process 3689693]
[Detaching after fork from child process 3689694]
[Detaching after fork from child process 3689695]
[Detaching after fork from child process 3689696]
[Detaching after fork from child process 3689697]
[Detaching after fork from child process 3689698]
[LWP 3674105 exited]
[LWP 3674107 exited]
[LWP 3674106 exited]
[LWP 3674104 exited]
[LWP 3674103 exited]
[LWP 3674102 exited]
[LWP 3674100 exited]
[LWP 3674099 exited]
[LWP 3674098 exited]
[LWP 3674097 exited]
[LWP 3674096 exited]
[LWP 3674095 exited]
[LWP 3674094 exited]
[LWP 3674093 exited]
[LWP 3674092 exited]
New process 3674091]

Program terminated with signal SIGKILL, Killed.
The program no longer exists.
Debugger has disconnected from the program '/home/borjamf/.vscode-server/extensions/ms-vscode.cpptools-1.19.1-linux-x64/bin/cpptools'.

And then it shows the message of Language server crashed. Sometimes I'm able to attach and it says something like

New LWP 228881]
[New LWP 228882]
[New LWP 228883]
[New LWP 233149]
0x00007f09b7d500a9 in __stdio_read ()

@sean-mcmanus by the way, if you're up for a call next week (Monday or Tuesday?), I have arranged with my company to allow it.

bobbrow commented 10 months ago

@borjamunozf, can you please send an email to c_cpp_support@microsoft.com and we can arrange a time?

borjamunozf commented 10 months ago

@borjamunozf, can you please send an email to c_cpp_support@microsoft.com and we can arrange a time?

email rejected: only accepts messages from people in its organization or on its allowed senders list, and your email address isn't on the list

comio commented 10 months ago

I tried to attach with gdb but I also receive the sigkill signal.

the last console output is the following

La configurazione di esplorazione personalizzata è stata ricevuta: {
  "browsePath": [
    ...
    about 1799 include directories
    ...
  ],
  "compilerPath": "/usr/bin/aarch64-linux-gnu-g++",
  "compilerArgs": [],
  "compilerFragments": [
    " -g -ggdb -Wall -Wconversion -Wno-unused-variable -Wno-unused-parameter -Wfatal-errors -Werror  -ffunction-sections -fdata-sections -O0 -Wno-implicit-fallthrough  -fPIC -DBOOST_SYSTEM_NO_DEPRECATED -DCMAKE -DARTEMIDE_REL_1_1 -D_TGT_ENV_ -DPCIE_ACCESS -DSMO_ECFM_WANTED -DCMAKE -MMD -Wno-shadow -Wno-misleading-indentation -Wno-implicit-fallthrough -g -Wall -Wextra -Wno-conversion -Wno-unused -Wno-unused-variable -Wno-unused-parameter -Wfatal-errors -Werror -Wpedantic  -Wzero-as-null-pointer-constant -Wsuggest-override -std=c++17 -Ofast -Wno-pedantic -Wno-conversion -Wno-zero-as-null-pointer-constant -g   -Wno-format -Wno-write-strings -Wno-uninitialized",
    "-std=gnu++17"
  ]
}

My environment is very complex with a lot of directories, libraries and executables. I can provide the full log if required (but cannot be pasted here).

The cpptools 1.17.5 seems to be the last working release.

bobbrow commented 9 months ago

@borjamunozf - I'm sorry about that. The email address was configured to accept email from external senders, but at some point the membership was consolidated to send to another internal distribution group that had the setting disabled. I believe I have fixed it, but it may take some time to update on the server. To expedite things you can send mail directly to me. Use my GitHub handle and append "@microsoft.com."