microsoft / vscode-cpptools

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

cpptools crash - `The language server crashed. Restarting...` #10651

Open Colengms opened 1 year ago

Colengms commented 1 year ago

image

We're very interested in fixing crashes. Information that could help us fix crashes include:

If you're experiencing a crash, any of the above information could be extremely useful to us to investigate and fix it. Please consider opening a new issue in this repo. Or, add a comment on this issue.

I'm pinning this issue, to make this more obvious to users who might be browsing our repo due to experiencing a crash.

godlikeue commented 3 months ago

Please tell me which previous version did not have this issue.

  1. I install a clean Ubuntu system on a new computer.
  2. sudo snap install --classic code
  3. install cpptools in extensions

Open a cpp file , this issue will occur!

godlikeue commented 3 months ago

I have tried many times and finally located the problematic version to be v1.19.2. If I revert to v1.19.1, as well as the earlier v1.18.5, this issue will not occur, and the IntelliSense is working now!

My vscode version is 1.89.1.

smp73 commented 2 months ago

@microsoft-github-policy-service agree company="Microsoft"

hbina commented 2 months ago

I am remotely developing on my RPI5, it appears that the LSP server is crashing consistently. This is the only output of cpptools.

[Error - 4:01:48 PM] The language server crashed. Restarting...
[Error - 4:01:48 PM] Server process exited with signal SIGSEGV.
abhishekd-1 commented 1 month ago

I am remotely developing on my RPI5, it appears that the LSP server is crashing consistently. This is the only output of cpptools.

[Error - 4:01:48 PM] The language server crashed. Restarting...
[Error - 4:01:48 PM] Server process exited with signal SIGSEGV.

I'm seeing the same thing as well on a Raspberry Pi 4 with extension version 1.21.2. Downgrading the C/C++ extension to v1.20.5 fixed the problem for me.

I'm running VS Code version 1.89.1 and have attached the crash stack here as instructed in the first post.

dkvg-77 commented 1 month ago

I have been receiving the following error message ever since the update was released 2 days ago.

[Error - 7:36:32 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:36:32 PM] The language server crashed 5 times in the last 3 minutes. It will not be restarted.
[Error - 7:36:32 PM] cpptools client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 7:36:32 PM] Server process exited with code 3221226505.

I just open up the VS code and this error is thrown. I tried reinstalling the extensions, reinstalling VS Code, and many other things.
But there has been no solution. Please help me.

I am using Windows.

imanabu commented 1 month ago

On Windows 11, the extension is now crashing on Language server in the past few days. What can I provide you to help diagnose this?

sean-mcmanus commented 1 month ago

@abhishekd-1 That crash is fixed with 1.21.4.

@dkvg-77 @imanabu Are you able to attach a debugger to the cpptools.exe process to get a crash call stack? https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv

dkvg-77 commented 1 month ago

Hey @sean-mcmanus

I have been trying to attach a debugger to the cpptools.exe process following the steps in the given URL. After clicking on the “Start Debugging” button, I get to attach a process. But I can't find 'cpptools.exe' option in there.

And, to talk about the problem of the extension, I am facing no issues in the 1.20.5 or below version. I am facing issues only in the last 3 updates.

Also for an option called 'C/C++ tag parser status', it says 'initializing'. Where as it says 'parsing complete' for the 1.20.5's version.

imanabu commented 1 month ago

@abhishekd-1 That crash is fixed with 1.21.4.

@dkvg-77 @imanabu Are you able to attach a debugger to the cpptools.exe process to get a crash call stack? https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv

Well, here is what happens so with my knowledge of VSC extensions, right now I am at a loss how to get this attach while the extension is starting up. I have a flutter project with Windows target and I think when that gets detected, the extension starts and then it crashes. I am on 1.21.4

sean-mcmanus commented 1 month ago

@dkvg-77 @imanabu It sounds like it's crashing too early to attach. Are you able to set C_Cpp.logginglevel to "Debug" and look at the C/C++ logging before the 2nd "cpptools/initialize" logging (which occurs after it crashes and re-initializes).

Does it crash with an empty workspace folder without any C/C++ files open? Does opening a file trigger the crash or adding certain files to the workspace folder? If you can attach before it crashes and then do something to trigger the crash, then you can get a crash call stack that way.