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

"The language server crashed" for CUDA projects with ">" in compile_commands #11289

Closed
chenyu-jiang opened this issue Aug 4, 2023 · 4 comments
Labels
bug Feature: Compile Commands fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix reliability
Milestone

Comments

@chenyu-jiang
Copy link

chenyu-jiang commented Aug 4, 2023

Environment

  • OS and Version: (local machine) MacOS Ventura 13.4
  • VS Code Version: 1.81.0
  • C/C++ Extension Version: v1.17.0
  • If using SSH remote, specify OS of remote machine: Ubuntu 20.04.6 LTS (Focal Fossa), in docker

Bug Summary and Steps to Reproduce

Bug Summary:
The language server crashes immediately when opening a CUDA project with ">" in compile_commands.json. Messages like The language server crashed. Restarting..., The language server crashed 5 times in the last 3 minutes. It will not be restarted. are displayed.

Steps to reproduce:

  1. Connect to the remote machine.
  2. Open an empty directory.
  3. Add the following c_cpp_properties.json to .vscode:
{
    "env": {
        "myDefaultIncludePath": [
            "${workspaceFolder}",
            "${workspaceFolder}/include",
            "/usr/include"
        ],
        "myCompilerPath": "/usr/bin/gcc"
    },
    "configurations": [
        {
            "name": "make",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "compilerPath": "/usr/bin/gcc"
        }
    ],
    "version": 4
}
  1. Create an empty file named test.cu.
  2. Add the following to ${workspaceFolder}/build/compile_commands.json:
[
    {
      "directory": "/root/empty_project/build",
      "command": "/usr/local/cuda/bin/nvcc -ccbin=/usr/bin/c++ -DSOME_ARG=\"<whatever.h>\" -isystem=/usr/local/cuda/include -isystem=/opt/nccl/build/include -g --generate-code=arch=compute_70,code=[compute_70,sm_70] -Xcompiler=-Wall -Xcompiler=-fPIC -gencode=arch=compute_70,code=sm_70 -std=c++14 -x cu -c /root/empty_project/test.cu -o /root/empty_project/test.cu.o",
      "file": "/root/empty_project/test.cu"
    }
]
  1. See the error The language server crashed...
    (The language server will not crash if -DSOME_ARG=\"<whatever.h>\" is removed.)

Expected behavior:
Language server not crashing.

Configuration and Logs

Configurations in c_cpp_properties.json:

{
    "env": {
        "myDefaultIncludePath": [
            "${workspaceFolder}",
            "${workspaceFolder}/include",
            "/usr/include"
        ],
        "myCompilerPath": "/usr/bin/gcc"
    },
    "configurations": [
        {
            "name": "make",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json",
            "compilerPath": "/usr/bin/gcc"
        }
    ],
    "version": 4
}

Logs from running C/C++: Log Diagnostics from the VS Code command palette:
(Log Diagnostics only works when not crashing)

-------- Diagnostics - 8/4/2023, 5:33:28 AM
Version: 1.17.0
Current Configuration:
{
    "name": "make",
    "compileCommands": "/root/empty_project/build/compile_commands.json",
    "compilerPath": "/usr/bin/gcc",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "compileCommandsInCppPropertiesJson": "${workspaceFolder}/build/compile_commands.json",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.17.0.0
No active translation units.
Browse Paths from compile_commands.json, from workspace folder: /root/empty_project
    /opt/nccl/build/include
    /root/empty_project
    /usr/local/cuda/bin/../targets/x86_64-linux/include
    /usr/local/cuda/include

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 7633

Logs from the language server logging:

[Error - 5:04:45 AM] The language server crashed. Restarting...
[Error - 5:04:47 AM] The language server crashed 5 times in the last 3 minutes. It will not be restarted.

Other Extensions

No other extensions are enabled.

Additional context

Call stacks when attaching debugger:

compile_commands_database::parse_entry(compile_commands_entry_t&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, compilation_args&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (Unknown Source:0)
compile_commands_database::get_compilation_args(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, configuration const&, compilation_args&, bool, bool&, std::unordered_set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) const (Unknown Source:0)
compile_commands_database::add_compile_command_paths(std::vector<include_path, std::allocator<include_path> >&, std::vector<include_path, std::allocator<include_path> >&, configuration const&, bool) (Unknown Source:0)
cpp_properties::provide_browse_path(bool) const (Unknown Source:0)
cpptools_context::set_browse_engine_directories(std::shared_ptr<workspace_folder_context> const&) (Unknown Source:0)
cpptools_context::cpptools_didChangeCppProperties(ConfigurationParams const&) (Unknown Source:0)
std::_Function_handler<void (lsp_manager::client_message&&), lsp_manager::register_request<ConfigurationParams, void, cpptools_context::cpptools_context()::{lambda(lsp_request<ConfigurationParams, void>&&)#23}>(std::basic_string_view<char, std::char_traits<char> >, cpptools_context::cpptools_context()::{lambda(lsp_request<ConfigurationParams, void>&&)#23}&&, int, bool, bool, bool)::{lambda(lsp_manager::client_message&&)#1}>::_M_invoke(std::_Any_data const&, lsp_manager::client_message&&) (Unknown Source:0)
std::_Function_handler<void (), thread_pool::enqueue<lsp_manager::queue_task(std::function<void ()>&&, int, bool)::{lambda()#1}, void>(lsp_manager::queue_task(std::function<void ()>&&, int, bool)::{lambda()#1}&&, std::future<void>*)::{lambda()#1}>::_M_invoke(std::_Any_data const&) (Unknown Source:0)
thread_pool::do_work(unsigned long) (Unknown Source:0)
msvc::thread_helper_t::thread_entry(void*) (Unknown Source:0)
start (Unknown Source:0)
[Unknown/Just-In-Time compiled code] (Unknown Source:0)
@sean-mcmanus
Copy link
Collaborator

Thanks for reporting this. I'm guessing it should be easy to fix.

@Colengms Colengms self-assigned this Aug 4, 2023
@Colengms Colengms changed the title "The language server crashed" for CUDA projects with escaped double quotes in compile_commands "The language server crashed" for CUDA projects with ">" in compile_commands Aug 4, 2023
@Colengms Colengms added the fixed Check the Milestone for the release in which the fix is or will be available. label Aug 4, 2023
@Colengms Colengms removed their assignment Aug 4, 2023
@michelleangela
Copy link
Contributor

Fix available in pre-release https://github.com/microsoft/vscode-cpptools/releases/tag/v1.17.1.

@chenyu-jiang
Copy link
Author

Thanks for the fix! It helps a lot.

@michelleangela
Copy link
Contributor

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

No branches or pull requests

4 participants