vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

Multiple Intellisense server crashes `handle_update_intellisense`, `handle_initialize`

Open BluTree opened this issue 11 months ago • 14 comments
trafficstars

Environment

  • OS and Version: 22631.3447
  • VS Code Version: 1.95.3
  • C/C++ Extension Version: 1.23.2

Bug Summary and Steps to Reproduce

Bug Summary: I am on an environment with configuration provider (homemade). With the latest extension version, The Intellisense server crashes very often, making the extension unusable. When writing some code, the server crash randomly with the error IntelliSense process crash detected: handle_update_intellisense. It tries to restart, but crash instantly, with this error IntelliSense process crash detected: handle_initialize.

Restarting VSCode make the Intellisense server work again, but then crash quickly after typing some code. I don't think it can come from the configuration provider, nothing changed in the last 6 months, and it worked without issues until this version.

I attached to the server to retrieve the first crash. It seems the crash comes from an invalid pointer dereference Exception thrown at 0x0000000140196619 in cpptools-srv.exe: 0xC0000005: Access violation reading location 0x0000000000000030 And the callstack of the crash:

cpptools-srv.exe!conv_line_loc_to_source_pos(char const *,struct a_source_position *) (Unknown Source:0)
cpptools-srv.exe!get_token(void) (Unknown Source:0)
cpptools-srv.exe!parse_source_fragment_into_token_cache(struct a_source_position *,struct a_source_position *) (Unknown Source:0)
cpptools-srv.exe!get_definition_of_class_from_source() (Unknown Source:0)
cpptools-srv.exe!get_definition_of_class(struct a_type *) (Unknown Source:0)
cpptools-srv.exe!f_instantiate_template_class_full(struct a_type *,unsigned int *,unsigned int *,int,int *) (Unknown Source:0)
cpptools-srv.exe!complete_type_is_needed(struct a_type *) (Unknown Source:0)
cpptools-srv.exe!check_field_type() (Unknown Source:0)
cpptools-srv.exe!decl_nonstatic_data_member() (Unknown Source:0)
cpptools-srv.exe!scan_nonstatic_data_member() (Unknown Source:0)
cpptools-srv.exe!class_member_declaration(struct a_class_def_state *,struct a_tmpl_decl_state *,struct an_ms_attribute *,int,int,struct a_template_param *,int *,struct a_type * *,struct a_template_instance *,struct a_template *,struct a_decl_pos_block *) (Unknown Source:0)
cpptools-srv.exe!scan_class_definition(struct a_type *,struct a_decl_parse_state *,int,int,int,int,int,int,struct a_template *,struct a_decl_pos_block *) (Unknown Source:0)
cpptools-srv.exe!get_definition_of_class(struct a_type *) (Unknown Source:0)
cpptools-srv.exe!f_instantiate_template_class_full(struct a_type *,unsigned int *,unsigned int *,int,int *) (Unknown Source:0)
cpptools-srv.exe!complete_type_is_needed(struct a_type *) (Unknown Source:0)
cpptools-srv.exe!check_field_type() (Unknown Source:0)
cpptools-srv.exe!decl_nonstatic_data_member() (Unknown Source:0)
cpptools-srv.exe!scan_nonstatic_data_member() (Unknown Source:0)
cpptools-srv.exe!class_member_declaration(struct a_class_def_state *,struct a_tmpl_decl_state *,struct an_ms_attribute *,int,int,struct a_template_param *,int *,struct a_type * *,struct a_template_instance *,struct a_template *,struct a_decl_pos_block *) (Unknown Source:0)
cpptools-srv.exe!scan_class_definition(struct a_type *,struct a_decl_parse_state *,int,int,int,int,int,int,struct a_template *,struct a_decl_pos_block *) (Unknown Source:0)
cpptools-srv.exe!get_definition_of_class(struct a_type *) (Unknown Source:0)
cpptools-srv.exe!f_instantiate_template_class_full(struct a_type *,unsigned int *,unsigned int *,int,int *) (Unknown Source:0)
cpptools-srv.exe!instantiate_template_class(struct a_type *,int *) (Unknown Source:0)
cpptools-srv.exe!f_is_generalized_identifier_start(__int64,struct a_type *) (Unknown Source:0)
cpptools-srv.exe!prescan_decl_specifiers() (Unknown Source:0)
cpptools-srv.exe!prescan_declaration() (Unknown Source:0)
cpptools-srv.exe!template_declaration() (Unknown Source:0)
cpptools-srv.exe!template_or_specialization_declaration_full(struct a_tmpl_decl_state *,int,struct a_decl_parse_state *) (Unknown Source:0)
cpptools-srv.exe!template_or_specialization_declaration() (Unknown Source:0)
cpptools-srv.exe!template_directive_or_declaration(enum a_token_kind *,int,struct a_source_position *) (Unknown Source:0)
cpptools-srv.exe!check_special_declaration_form() (Unknown Source:0)
cpptools-srv.exe!scan_nonmember_declaration(struct a_decl_parse_state *,struct a_source_range *) (Unknown Source:0)
cpptools-srv.exe!declaration(int,int,int,int,struct a_param_id *,struct a_source_range *,struct a_decl_parse_state *) (Unknown Source:0)
cpptools-srv.exe!namespace_declaration() (Unknown Source:0)
cpptools-srv.exe!check_special_declaration_form() (Unknown Source:0)
cpptools-srv.exe!scan_nonmember_declaration(struct a_decl_parse_state *,struct a_source_range *) (Unknown Source:0)
cpptools-srv.exe!declaration(int,int,int,int,struct a_param_id *,struct a_source_range *,struct a_decl_parse_state *) (Unknown Source:0)
cpptools-srv.exe!namespace_declaration() (Unknown Source:0)
cpptools-srv.exe!check_special_declaration_form() (Unknown Source:0)
cpptools-srv.exe!scan_nonmember_declaration(struct a_decl_parse_state *,struct a_source_range *) (Unknown Source:0)
cpptools-srv.exe!declaration(int,int,int,int,struct a_param_id *,struct a_source_range *,struct a_decl_parse_state *) (Unknown Source:0)
cpptools-srv.exe!process_translation_unit(char const *,int,struct an_exported_template_file *) (Unknown Source:0)
cpptools-srv.exe!cfe_main(int,char * * const) (Unknown Source:0)
cpptools-srv.exe!cfe_main_exception_handler(int,char * * const) (Unknown Source:0)
cpptools-srv.exe!invoke_edge_compiler() (Unknown Source:0)
cpptools-srv.exe!edge_compiler_main(int,char const * * const) (Unknown Source:0)
cpptools-srv.exe!preparse(int,char const * *,class a_scout_store *,class edge::translation_unit *) (Unknown Source:0)
cpptools-srv.exe!a_compiler_thread::compiler_thread_routine(class a_compiler_thread *) (Unknown Source:0)
cpptools-srv.exe!msvc::thread_helper_t::thread_entry(void *) (Unknown Source:0)
cpptools-srv.exe!thread_start<unsigned int (__cdecl*)(void *),1>() (Unknown Source:0)
kernel32.dll!BaseThreadInitThunk() (Unknown Source:0)
ntdll.dll!RtlUserThreadStart() (Unknown Source:0)

The subsequent crashes seem to be instant, and I can't attach to the process in order to check the callstack. I also created a dump for the crash link

Here are the options given by the configuration provider for the file:

sending compilation args for D:\Perforce\Stream\ICE\DebugGui\Sources\Menus\LLE\Video\WindowVideo.cpp
  include: D:\Perforce\Stream\ICE\DebugGui\Sources
  include: D:\Perforce\Stream\ICE
  include: D:\Perforce\Stream\SDK
  include: D:\Perforce\Stream\SDK\Jolt
  include: D:\Perforce\Stream\SDK\DearImGui
  include: D:\Perforce\Stream\SDK\DearImGui-Gizmo
  include: D:\Perforce\Stream\SDK\DearImGui-Node-Editor
  include: D:\Perforce\Stream\SDK\DearImGui-Plot
  include: D:\Perforce\Stream\SDK\MaterialDesignIcons\Includes
  include: D:\Perforce\Stream\SDK\DearImGui-Net\Code\Client
  include: D:\Perforce\Stream\ICE\DebugGui\Sources\Menus\LLE
  system include: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\include
  system include: C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.40.33807\atlmfc\include
  system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um
  system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\ucrt
  system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\shared
  system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\winrt
  system include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\cppwinrt
  define: USE_OPTICK
  define: NETWORK_CLIENT
  define: QDT_DEBUG
  define: NDEBUG
  define: PLATFORM_PC
  define: PLATFORM_WINDOWS
  define: WIN32
  define: _WIN64
  define: _WINDOWS
  define: _CRT_SECURE_NO_WARNINGS
  define: QDT_JOLT
  define: KSOUND_COMPONENT_ALLOW_PRIVATE
  stdver: ms_c++17
  intelliSenseMode: windows-msvc-x64

Configuration and Logs

-------- Diagnostics - 12/9/2024, 3:01:27 PM
Version: 1.23.2
Current Configuration:
{
    "name": "QDT",
    "includePath": [
        "d:/Perforce/Stream/ICE"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE"
    ],
    "windowsSdkVersion": "10.0.19041.0",
    "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe",
    "cStandard": "c17",
    "intelliSenseMode": "windows-msvc-x64",
    "configurationProvider": "qdt-maestro",
    "browse": {
        "limitSymbolsToIncludedHeaders": true,
        "path": [
            "d:/Perforce/Stream/ICE",
            "${workspaceFolder}"
        ]
    },
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe",
    "configurationProviderInCppPropertiesJson": "qdt-maestro",
    "cppStandard": "c++17",
    "mergeConfigurations": false
}
Modified Settings:
{
    "C_Cpp.errorSquiggles": "enabled",
    "C_Cpp.default.compilerPath": "cl.exe",
    "C_Cpp.default.cppStandard": "c++17",
    "C_Cpp.formatting": "clangFormat",
    "C_Cpp.doxygen.generateOnType": false,
    "C_Cpp.codeAnalysis.clangTidy.codeAction.formatFixes": false,
    "C_Cpp.codeAnalysis.clangTidy.enabled": true,
    "C_Cpp.codeAnalysis.clangTidy.path": "C:\\Program Files\\LLVM\\bin\\clang-tidy.exe",
    "C_Cpp.codeAnalysis.clangTidy.checks.disabled": [
        "clang-diagnostic-pragma-once-outside-header",
        "clang-analyzer-security.insecureAPI.strcpy"
    ],
    "C_Cpp.intelliSenseMemoryLimit": 16384,
    "C_Cpp.loggingLevel": "Debug",
    "C_Cpp.experimentalFeatures": "enabled",
    "C_Cpp.caseSensitiveFileSupport": "enabled"
}
Additional Tracked Settings:
{
    "editorTabSize": 4,
    "editorInsertSpaces": false,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "*.sln": "xml",
        "log": "log",
        "*.idl": "cpp",
        "*.inc": "cpp",
        "*.ipp": "cpp",
        "*.qdh": "cpp",
        "*.rh": "cpp",
        "*.tcc": "cpp",
        "*.txt": "cpp",
        "__bit_reference": "cpp",
        "__config": "cpp",
        "__debug": "cpp",
        "__functional_03": "cpp",
        "__functional_base": "cpp",
        "__functional_base_03": "cpp",
        "__hash_table": "cpp",
        "__locale": "cpp",
        "__mutex_base": "cpp",
        "__refstring": "cpp",
        "__split_buffer": "cpp",
        "__sso_allocator": "cpp",
        "__std_stream": "cpp",
        "__tree": "cpp",
        "__tuple": "cpp",
        "__tuple_03": "cpp",
        "algorithm": "cpp",
        "any": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "bit": "cpp",
        "bitset": "cpp",
        "cassert": "cpp",
        "cctype": "cpp",
        "cerrno": "cpp",
        "cfenv": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "climits": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "codecvt": "cpp",
        "compare": "cpp",
        "complex": "cpp",
        "concepts": "cpp",
        "condition_variable": "cpp",
        "copyable_atomic": "cpp",
        "coroutine": "cpp",
        "csetjmp": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctgmath": "cpp",
        "ctime": "cpp",
        "cuchar": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "dynarray": "cpp",
        "exception": "cpp",
        "expected": "cpp",
        "filesystem": "cpp",
        "format": "cpp",
        "forward_list": "cpp",
        "fstream": "cpp",
        "functional": "cpp",
        "future": "cpp",
        "hash_map": "cpp",
        "hash_set": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "ios": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "iterator": "cpp",
        "limits": "cpp",
        "list": "cpp",
        "locale": "cpp",
        "map": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "ostream": "cpp",
        "queue": "cpp",
        "random": "cpp",
        "ranges": "cpp",
        "ratio": "cpp",
        "regex": "cpp",
        "rope": "cpp",
        "scoped_allocator": "cpp",
        "set": "cpp",
        "shared_mutex": "cpp",
        "slist": "cpp",
        "span": "cpp",
        "sstream": "cpp",
        "stack": "cpp",
        "stdexcept": "cpp",
        "stdfloat": "cpp",
        "stop_token": "cpp",
        "streambuf": "cpp",
        "string": "cpp",
        "string_view": "cpp",
        "strstream": "cpp",
        "system_error": "cpp",
        "thread": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "utility": "cpp",
        "valarray": "cpp",
        "variant": "cpp",
        "vector": "cpp",
        "xcomplex": "cpp",
        "xfacet": "cpp",
        "xfunctional": "cpp",
        "xfunctional2": "cpp",
        "xhash": "cpp",
        "xhash_old": "cpp",
        "xheap": "cpp",
        "xiosbase": "cpp",
        "xiter": "cpp",
        "xlocale": "cpp",
        "xlocbuf": "cpp",
        "xlocinfo": "cpp",
        "xlocmes": "cpp",
        "xlocmon": "cpp",
        "xlocnum": "cpp",
        "xloctime": "cpp",
        "xmemory": "cpp",
        "xmemory0": "cpp",
        "xmemory1": "cpp",
        "xnode": "cpp",
        "xscan": "cpp",
        "xstddef": "cpp",
        "xstring": "cpp",
        "xthread": "cpp",
        "xtr1common": "cpp",
        "xtree": "cpp",
        "xutility": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true,
        "__progen__": true,
        "TOOLS BIN": true,
        "TOOLS SOURCE": true,
        "SDK": true,
        "**/*.lua": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
Custom browse configuration: 
{
    "browsePath": [
        "ICE",
        "Fire",
        "ICE-Test"
    ],
    "standard": "c++17",
    "compilerPath": "cl.exe",
    "compilerArgs": [
        "/W4",
        "/WX"
    ],
    "windowsSdkVersion": "10.0"
}
cpptools version (native): 1.23.2.0
Current database path: C:\Users\ava\AppData\Local\Microsoft\vscode-cpptools\c84b6ecf9a362be124b9c61c25e5626a\.browse.VC.db
No active translation units.

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

Other Extensions

No response

Additional context

BluTree avatar Dec 09 '24 14:12 BluTree

Hi @BluTree . The crash looks to be related to parsing of specific source code. Would you be able to isolate the source code involved to provide a stand-alone repro we could investigate further?

Colengms avatar Dec 09 '24 18:12 Colengms

I have been trying to gradually minimize the code in order to have a standalone repro the last days, without success. The codebase I work on is pretty big, so stripping code line by line takes a really long time.

The crash doesn't seem to be present constantly, sometimes it triggers instantly when opening the header (parsed with the configuration of the source file including it), sometimes not. From what I tested, this can happen with both the configuration provider registered. This also happens whether the C_Cpp.caseSensitiveFileSupport setting is enabled or not.

BluTree avatar Dec 12 '24 15:12 BluTree

Hey @Colengms, this issue might need further attention.

@BluTree, you can help us out by closing this issue if the problem no longer exists, or adding more information.

github-actions[bot] avatar Jan 12 '25 11:01 github-actions[bot]

I can reproduce/see this issue all the time on the https://github.com/facebookincubator/velox code base.

I'm using Version: 1.96.2 Commit: fabdb6a30b49f79a7aba0f2ad9df9b399473380f Date: 2024-12-19T10:22:47.216Z Electron: 32.2.6 ElectronBuildId: 10629634 Chromium: 128.0.6613.186 Node.js: 20.18.1 V8: 12.8.374.38-electron.0 OS: Linux x64 6.8.0-49-generic snap

abbas-gadhia avatar Jan 17 '25 11:01 abbas-gadhia

@abbas-gadhia If you can share some steps to reproduce the crash, we would appreciate it. I cloned and configured velox on Ubuntu but have not been able to reproduce a crash so far.

bobbrow avatar Feb 01 '25 00:02 bobbrow

  1. Open fresh project
  2. Open file VectorFunction.h (There should be a squiggly red line under #include "velox/expression/FunctionSignature.h" saying "cannot open source file "memory" (dependency of "velox/expression/FunctionSignature.h"). Please run the 'Select IntelliSense Configuration...' command to locate your system headers.C/C++(1696)"
  3. Ctrl-Click on FunctionSignature.h on the # include line
  4. Hover over "#include "velox/expression/signature_parser/SignatureParser.h" in FunctionSignature.h

IntelliSense process crash detected: handle_quick_info

@bobbrow

abbas-gadhia avatar Feb 05 '25 14:02 abbas-gadhia

I tried your repro, but I do not have an error under that line and it does not crash for me. The extension detects my compiler and is able to find <memory>.

Can you run the C/C++: Log Diagnostics command and share the output so I can compare my configuration with yours?

bobbrow avatar Feb 05 '25 17:02 bobbrow

This is the output


-------- Diagnostics - 05/02/2025, 22:41:29
Version: 1.23.5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/abbas/src/velox/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "linux-clang-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/home/abbas/src/velox/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.intelliSenseMode": "linux-clang-x64"
}
Additional Tracked Settings:
{
    "editorTabSize": 2,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "any": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "strstream": "cpp",
        "bit": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "cctype": "cpp",
        "cfenv": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "codecvt": "cpp",
        "compare": "cpp",
        "complex": "cpp",
        "concepts": "cpp",
        "condition_variable": "cpp",
        "coroutine": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "forward_list": "cpp",
        "list": "cpp",
        "map": "cpp",
        "set": "cpp",
        "string": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "algorithm": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "ratio": "cpp",
        "regex": "cpp",
        "source_location": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "fstream": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "numbers": "cpp",
        "ostream": "cpp",
        "semaphore": "cpp",
        "shared_mutex": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "stop_token": "cpp",
        "streambuf": "cpp",
        "thread": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "variant": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.5.0
Current database path: /home/abbas/.cache/vscode-cpptools/c69d0b32b38e22bafcd3250bfc008fce/.browse.VC.db
No active translation units.

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

abbas-gadhia avatar Feb 05 '25 17:02 abbas-gadhia

Thank you @abbas-gadhia. I was unable to reproduce a crash when I used that config, but given the symptoms of not finding a standard header, I tried setting the compilerPath to "" (to disable system header path detection) and it began to crash for me. I didn't have to open the second header file like you did, but I will work with this repro and try to reduce it to something smaller that I can send to the team managing the IntelliSense compiler.

Now... the fact that IntelliSense is unable to find the memory header even though you set a compiler path leads me to believe that the extension is having trouble configuring IntelliSense with your compiler. I've never seen that happen with clang before, but we do have some additional logging that we can look at. To get you unblocked, I'd like to troubleshoot this issue a little bit further which should hopefully allow us to get you in a state where the extension will stop crashing for you.

To enable it, please:

  1. Set the C_Cpp.loggingLevel setting to "Debug"
  2. Reload the Window
  3. In the Output Window, select C/C++ from the drop down box on the far right side to see our logging.

When you see the logging show up, search for Attempting to get defaults from C++ compiler in "compilerPath" property and let us know if you see any errors appearing beneath that line.

bobbrow avatar Feb 05 '25 18:02 bobbrow

Hi @bobbrow Here are some relevant parts of the log


Attempting to get defaults from C compiler in "compilerPath" property: '/usr/bin/clang'
Compiler info database not connected - skipping load.
Compiler query command line: /usr/bin/clang -std=c++17 -m64 -Wp,-v -fno-blocks -E -dM -x c++ /dev/null
Attempting to get defaults from C++ compiler in "compilerPath" property: '/usr/bin/clang'
ag parsing file: /usr/include/mit-krb5/gssrpc/rename.h
  Parsing: 1031 files(s) processed
Done parsing remaining files.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
PCH warning: header stop not at file scope.  An IntelliSense PCH file was not generated.
Error squiggles will be disabled in: file:///home/abbas/src/velox/velox/substrait/SubstraitToVeloxPlan.cpp
Update IntelliSense time (sec): 3.271

A C/C++ extension process has crashed. The crashing process name, date/time, signal, and call stack are below -- it would be helpful to include that in a bug report at https://github.com/Microsoft/vscode-cpptools/issues.

cpptools-srv
06/02/2025, 14:16:38
SIGSEGV
a_region_tracker::build_sections()+982
a_tracking_manager::check_edits(a_canonicalized_file_name, msvc::strong_typedef<msvc::offset_traits<msvc::offset_tag_t>>, msvc::strong_typedef<msvc::offset_traits<msvc::offset_tag_t>>, bool, bool*, bool*, a_tracked_region**, a_region_scope_info*) const+892
edge::scoped_query_manager::check_and_compile(edge::file_position const&, edge::file_position const&, edge::file_position const&, bool, bool, bool)+899
edge::scoped_query_manager::get_trees_overlapping_span(a_canonicalized_file_name, msvc::strong_typedef<msvc::offset_traits<msvc::offset_tag_t>>, msvc::strong_typedef<msvc::offset_traits<msvc::offset_tag_t>>, int, edge::tree_query_result_builder*)+173
edge::intellisense_operation::symbol_at_cursor(bool, edge::macro_invocation_info*)+193
std::_Function_handler<void (edge::intellisense_operation&, cpp_intellisense::QuickInfoResponse&), edge_intellisense_server_impl::handle_quick_info(cpp_intellisense::DocumentPosition const&, int, cpp_intellisense::QuickInfoResponse&, snapshot::snapshot_session_t const&)::{lambda(edge::intellisense_operation&, cpp_intellisense::QuickInfoResponse&)#1}>::_M_invoke(std::_Any_data const&, edge::intellisense_operation&, cpp_intellisense::QuickInfoResponse&)+151
void edge_intellisense_operation::perform_isense_operation<cpp_intellisense::QuickInfoResponse>(char const*, edge::file_position const&, std::function<void (edge::intellisense_operation&, cpp_intellisense::QuickInfoResponse&)>&&, cpp_intellisense::QuickInfoResponse&, snapshot::snapshot_session_t const&, bool)+342
edge_intellisense_server_impl::handle_quick_info(cpp_intellisense::DocumentPosition const&, int, cpp_intellisense::QuickInfoResponse&, snapshot::snapshot_session_t const&)+625
cpp_intellisense::server_stub::handle_quick_info(msvc::deserializer_t&, msvc::serializer_t&)+313
msvc::base_channel_t::dispatch_message(std::vector<unsigned char, std::allocator<unsigned char>> const&, std::vector<unsigned char, std::allocator<unsigned char>>&)+571
msvc::common_channel_t::perform_call(unsigned int, std::vector<unsigned char, std::allocator<unsigned char>> const&)+66

abbas-gadhia avatar Feb 06 '25 08:02 abbas-gadhia

@abbas-gadhia, thank you. I'm surprised to not see any errors with that compiler query.

I was able to reproduce that same crash yesterday and began the process of reducing it to something we can debug. Unfortunately, this is a slow process as I rip out headers and blocks of code bit by bit. But I'm very grateful you've led us to this callstack because it is our highest hitting crash for a few months and we've been searching for a repro.

If I could ask you for one last bit of logging, could you run that C/C++: Log Diagnostics command again, but this time, open the source file first? This will add the resolved IntelliSense configuration for the file to the output.

bobbrow avatar Feb 06 '25 16:02 bobbrow

welcome :)

Here's the o/p

-------- Diagnostics - 06/02/2025, 22:07:40
Version: 1.23.5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/home/abbas/src/velox/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/clang",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "linux-clang-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/clang",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/home/abbas/src/velox/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.default.intelliSenseMode": "linux-clang-x64",
    "C_Cpp.loggingLevel": "Debug"
}
Additional Tracked Settings:
{
    "editorTabSize": 2,
    "editorInsertSpaces": true,
    "editorAutoClosingBrackets": "languageDefined",
    "filesEncoding": "utf8",
    "filesAssociations": {
        "any": "cpp",
        "array": "cpp",
        "atomic": "cpp",
        "strstream": "cpp",
        "bit": "cpp",
        "*.tcc": "cpp",
        "bitset": "cpp",
        "cctype": "cpp",
        "cfenv": "cpp",
        "charconv": "cpp",
        "chrono": "cpp",
        "cinttypes": "cpp",
        "clocale": "cpp",
        "cmath": "cpp",
        "codecvt": "cpp",
        "compare": "cpp",
        "complex": "cpp",
        "concepts": "cpp",
        "condition_variable": "cpp",
        "coroutine": "cpp",
        "csignal": "cpp",
        "cstdarg": "cpp",
        "cstddef": "cpp",
        "cstdint": "cpp",
        "cstdio": "cpp",
        "cstdlib": "cpp",
        "cstring": "cpp",
        "ctime": "cpp",
        "cwchar": "cpp",
        "cwctype": "cpp",
        "deque": "cpp",
        "forward_list": "cpp",
        "list": "cpp",
        "map": "cpp",
        "set": "cpp",
        "string": "cpp",
        "unordered_map": "cpp",
        "unordered_set": "cpp",
        "vector": "cpp",
        "exception": "cpp",
        "algorithm": "cpp",
        "functional": "cpp",
        "iterator": "cpp",
        "memory": "cpp",
        "memory_resource": "cpp",
        "numeric": "cpp",
        "optional": "cpp",
        "random": "cpp",
        "ratio": "cpp",
        "regex": "cpp",
        "source_location": "cpp",
        "string_view": "cpp",
        "system_error": "cpp",
        "tuple": "cpp",
        "type_traits": "cpp",
        "utility": "cpp",
        "fstream": "cpp",
        "future": "cpp",
        "initializer_list": "cpp",
        "iomanip": "cpp",
        "iosfwd": "cpp",
        "iostream": "cpp",
        "istream": "cpp",
        "limits": "cpp",
        "mutex": "cpp",
        "new": "cpp",
        "numbers": "cpp",
        "ostream": "cpp",
        "semaphore": "cpp",
        "shared_mutex": "cpp",
        "sstream": "cpp",
        "stdexcept": "cpp",
        "stop_token": "cpp",
        "streambuf": "cpp",
        "thread": "cpp",
        "typeindex": "cpp",
        "typeinfo": "cpp",
        "variant": "cpp"
    },
    "filesExclude": {
        "**/.git": true,
        "**/.svn": true,
        "**/.hg": true,
        "**/CVS": true,
        "**/.DS_Store": true,
        "**/Thumbs.db": true
    },
    "filesAutoSaveAfterDelay": false,
    "editorInlayHintsEnabled": true,
    "editorParameterHintsEnabled": true,
    "searchExclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/*.code-search": true
    },
    "workbenchSettingsEditor": "ui"
}
cpptools version (native): 1.23.5.0
Current database path: /home/abbas/.cache/vscode-cpptools/c69d0b32b38e22bafcd3250bfc008fce/.browse.VC.db
Translation Unit Mappings:
[ /home/abbas/src/velox/velox/expression/FunctionSignature.cpp - source TU]:
    /home/abbas/src/velox/velox/expression/FunctionSignature.h
[ /home/abbas/src/velox/velox/expression/VectorFunction.h - source TU]:
Translation Unit Configurations:
[ /home/abbas/src/velox/velox/expression/FunctionSignature.cpp ]
    Process ID: 208130
    Memory Usage: 134 MB
    Compiler Path: /usr/bin/clang
    Includes:
        /home/abbas/src/velox
    System Includes:
        /usr/include/c++
        /usr/lib/llvm-18/lib/clang/18/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++17
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=180108
[ /home/abbas/src/velox/velox/expression/VectorFunction.h ]
    Process ID: 208186
    Memory Usage: 257 MB
    Compiler Path: /usr/bin/clang
    Includes:
        /home/abbas/src/velox
    System Includes:
        /usr/include/c++
        /usr/lib/llvm-18/lib/clang/18/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++17
    IntelliSense Mode: linux-clang-x64
    Other Flags:
        --clang
        --clang_version=180108
Total Memory Usage: 392 MB

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


abbas-gadhia avatar Feb 06 '25 16:02 abbas-gadhia

This part I don't understand...

Configuration:

    "includePath": [
        "/home/abbas/src/velox/**"
    ],

Resolved Configuration:

    Includes:
        /home/abbas/src/velox

Your configuration specifies to use our "recursive include path" feature, but the actual configuration only has that one path instead of the 20 or so that mine has. Either way, we're arriving at the same crash via misconfigured IntelliSense. If you'd like to Reload the window and send us the full log, maybe we can figure out what's going on here (a separate bug).

In any case, we have the information we need to investigate the crash. While we work on this, I would recommend using the CMake Tools extension for this repository. It is capable of providing correct configurations for the files in this repository which do not result in so many crashes (I used it, but I disabled it temporarily for this investigation).

bobbrow avatar Feb 06 '25 16:02 bobbrow

I've attached the full log. Thanks for the tip! I changed the Intellisense mode to linux-gcc-x64 and the red squigglies went away :)

intellisense-crash.txt

abbas-gadhia avatar Feb 07 '25 08:02 abbas-gadhia