Skip to content
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

Language Server Crashed #10598

Closed
ajwentzel opened this issue Feb 27, 2023 · 13 comments
Closed

Language Server Crashed #10598

ajwentzel opened this issue Feb 27, 2023 · 13 comments
Assignees
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Milestone

Comments

@ajwentzel
Copy link

Environment

  • OS and Version: Windows 10 21H2
  • VS Code Version: 1.75.1
  • C/C++ Extension Version: 1.14.3
  • If using SSH remote, specify OS of remote machine: N/A

Bug Summary and Steps to Reproduce

Bug Summary:
Tried using the RP2040 Feather from Adafruit (https://www.adafruit.com/product/4884), following the setup guide here (https://learn.adafruit.com/adafruit-feather-rp2040-pico/arduino-ide-setup). Everything works fine on the Arduino IDE, but when I switch to VS Code, I get the following error:

[Error - 9:24:01 AM] Sending request cpptools/getInlayHints failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 9:24:01 AM] Sending request cpptools/getSemanticTokens failed.
Message: Pending response rejected since connection got disposed
Code: -32097
[Error - 9:24:01 AM] The language server crashed 5 times in the last 3 minutes. It will not be restarted.

The code is a very simple .ino file with blank setup() and loop() functions. If I switch to a different board, the code compiles with no problem, so it seems like it's specific to the RP2040. I've attached both the c_cpp_properties.json and the language server logs.
c_cpp_properties.txt
CCpp Language Server Logging.txt

Configuration and Logs

See attached logs

Other Extensions

Other Extensions:
Arduino v0.5.0
Serial Monitor v0.8.0
Both C/++ and Serial Monitor are required for using the Arduino extension.

Additional context

I tried attaching the debugger following the guides here (https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv), but there is no option for 'cpptools' when I try to attach it.

@Colengms
Copy link
Collaborator

Hi @ajwentzel . Thanks for reporting this. Based on your logs, it looks like the extension works for some time before crashing. Would you be able to attach the debugger to cpptools.exe before it crashes, and provide the resulting stack? That would help immensely.

https://github.com/microsoft/vscode-cpptools/wiki/Attaching-debugger-to-cpptools-or-cpptools%E2%80%90srv

@Colengms Colengms self-assigned this Feb 27, 2023
@Colengms Colengms added Language Service more info needed The issue report is not actionable in its current state labels Feb 27, 2023
@ajwentzel
Copy link
Author

@Colengms Thanks for the quick reply. As I mentioned above the cpptools.exe does not show up as an attach option when following those steps. Same result as the person in this issue (#10385 (comment)), but it looks like that issue was closed so I'm not sure what other steps to take.

@Colengms
Copy link
Collaborator

Colengms commented Feb 27, 2023

@ajwentzel . There are a couple possible causes that come to mind. The extension does not start up until it's activated, such as by opening a .cpp file. Can you confirm the extension has activated before you try to attach to it? Or, perhaps by the time you're trying to attach to it, the process has already crashed? Could you confirm that by checking the C/C++ log output? Since your log indicated activity, it looks like you should have time between activating the extension and it crashing, to attach to it. Also, could you try using a workspace folder the crash does not occur with, and check whether you are able to attach to cpptools.exe in that scenario? I'm curious if the issue is that the process is not running, or if it's being filtered out for some reason. You might also check the task manager, to see if cpptools.exe is listed at the time. Note that there will be 2 instances of the process running, and you'd want to attach to the more sizable one.

@ajwentzel
Copy link
Author

I switched the board to one that I knew worked (Feather M0), added a couple basic files called Test.h and Test.cpp and restarted VS Code. I was then able to attach the debugger to cpptools since nothing crashed. Then I switched the board back to the Feather RP2040. Attached the call stacks from that.
cpptools call stack.txt
lsp_manager thread call stack.txt

Something I noticed while going through this process.
1 - Start with the Feather M0 selected
2 - Compile
3 - Switch to the Feather RP2040
4 - VS Code will recognize the board change and auto compile. At this point the language server crashes.
5 - Switch back to the Feather M0.
6 - VS Code will recognize the board change and auto compile. I let it finish compiling.
7 - Restart VS Code with no issues.

  • If instead at step 6, I close VS Code before it has a chance to compile with the M0.
  • Restart VS Code. The language server will crash here because even though the Feather M0 is selected, it hasn't had a chance to compile with it (possibly from something in the c_cpp_properties.json file it generates?)

Not sure if this is useful to you, just something I noticed.

@sean-mcmanus
Copy link
Collaborator

We have a previous issue at #10486 for that same crash call stack, but this issue has more repro details.

@Colengms
Copy link
Collaborator

Hi @ajwentzel . Thanks. This will help us a lot.

The code involved in the crash is related to placing squiggles within a source file, possibly a particular source file, and relates to some squiggle locations that may be outside of the bounds of the file. Is there a specific file that's open when this occurs that may be involved in the repro?

@ajwentzel
Copy link
Author

The only file I have explicitly open is Testing.ino.
image

Is there somewhere else that something could be open?

@Colengms
Copy link
Collaborator

Hi @ajwentzel . The IntelliSense results being processed when the crash occurs appear to be related to that file. Would you be able to provide the contents of that file? That might help us repro and test a fix.

That file may be included by a source file, and cpptools may be choosing the source file to generate IntelliSense for the header. That source file, and other headers that are included, may be part of the repro as well. Is this something simple enough that you could zip up and share, that we could use to repro?

@ajwentzel
Copy link
Author

It's honestly just a blank arduino sketch, but I zipped the whole folder for you. You can ignore the .txt files since those are just places I copied logs for attaching here.

Testing.zip

@Colengms
Copy link
Collaborator

Hi @ajwentzel . One more question; I see that you're using packages\\rp2040. But, when I use the Arduino extension (or Arduino IDE), the RP2040 boards I install do not get stored in that location. Can you clarify how/where to install those support files?

@ajwentzel
Copy link
Author

I added this line: "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json"
to the Additional Boards Manager URLs in the Arduino IDE preferences.

@ajwentzel
Copy link
Author

Also, in case it matters, the Arduino IDE version is 1.8.15.

@Colengms Colengms added bug and removed more info needed The issue report is not actionable in its current state labels Feb 27, 2023
@Colengms Colengms added this to the 1.14.4 milestone Feb 27, 2023
@Colengms Colengms added the fixed Check the Milestone for the release in which the fix is or will be available. label Feb 28, 2023
@sean-mcmanus
Copy link
Collaborator

@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed Check the Milestone for the release in which the fix is or will be available. Language Service
Projects
None yet
Development

No branches or pull requests

3 participants