-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpptools crash - The language server crashed. Restarting...
#10651
Comments
Just to remind that on |
@H-G-Hristov Yes, but that issue mentions a work around via running |
I've reproed multiple crashes. I'm tracking it with #10636 . We may not need this issue anymore. |
Reopening. The intent of this issue was to be pinned so users experiencing a crash can find the issue and easily find instructions. I'd like to keep this open and pinned for now. |
@Colengms Yeah, that seems fine, but user should know that we don't currently have a widespread crashing issue (as of https://github.com/microsoft/vscode-cpptools/releases/tag/v1.14.5 or later). |
Working with a large Visual Studio solution of ~70 C# projects and one C++/CMake project. Also had the same solution open in Visual Studio at the same time. Performed a Rebuild in Visual Studio and then came back to 10000+ duplicate errors in VS Code like this:
|
@OnielN14 @chris0306 @doxxx That info is insufficient. We more info, particular the info that's described in the description for this issue, such as a call stack of cpptools or a repro. |
@OnielN14 @chris0306 @doxxx Also, 1.17.1 and 1.17.2 of our extension has some crash fixes, so that may be worth trying. |
I start to have the same issue since the extension auto-updated to 1.17.3 today. I'm running AlmaLinux 8.8 with kernel 4.18.0-477.15.1.el8_8.x86_64. The VSCode version is 1.81 Not sure if this is any useful, but the output message is:
Is there any known workaround for this problem? Fixed the problem by downgrading to 1.16.3. Downgrading from 1.17.3 to 1.17.2 didn't work. PS: This happens only when I try to use VSCode with a very large project. For a medium-sized project, it works fine. |
@vineetsoni it looks like the extension isn't recovering from a crash properly. There were some code changes in this area recently, so thank you for reporting it. I'll move your report into a new issue. |
@bobbrow fileChanged/Created/Deleted triggers an IntelliSense update unless the file or the file's folder is filtered from a files.exclude setting. So sure you can put the cmake build folder in your workspace folder, but you should also add it to the C_Cpp.files.exclude to avoid unnecessary IntelliSense updating. |
Can we change that behavior? If it's obviously not a C or C++ file, I don't see why we would want to trigger an IntelliSense update. We have filters for non-C/C++ files (based on file extension) in the TypeScript code so it doesn't seem wrong to do the same thing in the language server. |
How to get a call stack? I cannot attach a debugger because the crash arises before that. If I open cpptools.exe outside VS Code, I cannot reproduce the crash. The executable does nothing. |
@SemenAntonov Your issue is with the clangd extension and not our extension. |
Please tell me which previous version did not have this issue.
Open a cpp file , this issue will occur! |
I have tried many times and finally located the problematic version to be My vscode version is 1.89.1. |
I am remotely developing on my RPI5, it appears that the LSP server is crashing consistently. This is the only output of cpptools.
|
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. |
I have been receiving the following error message ever since the update was released 2 days ago.
I just open up the VS code and this error is thrown. I am using Windows. |
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? |
@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 |
Hey @sean-mcmanus I have been trying to attach a debugger to the cpptools.exe process following the steps in the given URL. And, to talk about the problem of the extension, Also for an option called 'C/C++ tag parser status', it says 'initializing'. |
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 |
@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. |
I am getting this crash with the release and beta versions, and I would love to help you track this down because intellisense has always been hit or miss for me for (literally) decades! I have attached to the 'ms-vscode.cpptools-1.22.11-win32-x64\bin\cpptools.exe' process, but it just eventually exits with exit code 0, so I can't get a stack trace from that. This is the log from the Output window:
Adrian Stephens |
@adrianstephens You may be seeing a crash with cpptools-srv.exe. There info on getting a stack on Windows at https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv . |
@sean-mcmanus I don't see a process called that, but the message about the language server crashing happens very soon after cpptools.exe exits. Is cpptools-srv spawned by cpptools.exe? If so, I can try and intercept where that happens |
@adrianstephens Yeah, if you're getting the "language server crashed" notification and no cpptools-srv is launched, then it sounds like cpptools is crashing, but if you attach and it exits normally it sounds like it might not be crashing and instead exiting normally for some unexpected reason. Make sure you have "symbolSearchPath": "https://msdl.microsoft.com/download/symbols" set. If you attach and use the Pause button you should be able to see some info on the thread call stacks. |
@sean-mcmanus Yes, I do see symbols; I added this to my launch script:
which I suppose I'd assumed was the default |
@adrianstephens But you don't get an exception notification? The command logged is But your crash issue sounds like a very particular crash scenario and it probably should be tracked in a separate issue instead of this "catch all" issue. |
@sean-mcmanus The database is seemingly never created; the folder is there (C:\Users\adrian\AppData\Local\Microsoft\vscode-cpptools\d720ade87aeabca9e1a090a5f4fac8b8) but empty. The furthest back I can go using marketplace is 1.22.9, and that exhibits all the same behaviour (no database, cpptools.exe exiting cleanly, 'language server crashed') |
@adrianstephens The marketplace UI seems to limit the versions when it shouldn't. You can get 1.21.6 from within VS Code itself or from GitHub at https://github.com/microsoft/vscode-cpptools/releases/tag/v1.21.6 . Yeah, the failure to create the database is the root problem, and the queryCompilerDefaults code might not be handling that failure correctly -- we can look into simulating a database failure in that code path to see if we can reproduce the issue and/or find a cause. There might be some unexpected issue with that location so it might be fixed if you change the databaseFilename location. I'll create a new issue to track that. |
I used to have the database location set to ${workspaceFolder}/.vscode, and changed it to the default in case that was the problem, so I don't think it's going to be location specific. 1.21.6 exhibits the same problem (though it creates an additional error popup 'Sending document notification textDocument/didOpen failed.'). |
@adrianstephens The databaseFilename needs to have the file too, like
You may be able to get more database error logging by temporarily setting C_Cpp.loggingLevel to the hidden value of "7", string not a number, (and "8" might give more info too...I can't remember what logging level we set the sqlite error messages at). Yeah, it would be better to discuss it in #12976 . |
Fixes microsoft#10651 Add new functions to handle crash file reading and logging telemetry. * **Extension/src/LanguageServer/extension.ts** - Add `handleCrashFileRead`, `logCrashTelemetry`, `logMacCrashTelemetry`, and `logCppCrashTelemetry` functions. - Modify `reportMacCrashes` to use `handleCrashFileRead`. * **Extension/src/LanguageServer/clientCollection.ts** - Modify `recreateClients` to handle crash recovery using `handleCrashFileRead`. * **Extension/src/logger.ts** - Add `getCrashCallStacksChannel` function. - Modify `log` function to use `getCrashCallStacksChannel`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/microsoft/vscode-cpptools/issues/10651?shareId=XXXX-XXXX-XXXX-XXXX).
|
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.
The text was updated successfully, but these errors were encountered: