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

llvm-project file causes tag parser crash (Warning: Database safety check failed. Recreating database)

Open Bestie123 opened this issue 1 year ago • 5 comments

Environment

  • OS and version: windows 10
  • VS Code: 1.69.2
  • C/C++ extension: 1.11.4

Bug Summary and Steps to Reproduce

Bug Summary:

  • cpptools: Connection to server got closed. Server will not be restarted.
  • c/c++ : Warning: Database safety check failed. Recreating database. directory used as a project: https://github.com/llvm/llvm-project
  1. you can download it only because an error occurs when analyzing this file https://github.com/llvm/llvm-project/blob/main/libcxx/test/support/test.support/make_string_header.pass.cpp

  2. open folder in vs code

  3. automatic analize

  4. error

Expected behavior

when installing c/c++ 1.10.8, the project analyzes normally and no errors appear

Code sample and Logs

c_cpp_properties.json


{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++14",
            "intelliSenseMode": "windows-msvc-x64"
        }
    ],
    "version": 4
}

Screenshots

  • C/C++ extension: 1.11.4 output to the console when analyzing a file when an error occurs, and start re-analyzing the project.

G:\2\libcxx\test\support\test.support\make_string_header.pass.cpp image

cpptools console error image

when installing c/c++ 1.10.8, the project analyzes normally and no errors appear, a message about the completion of the analysis is displayed in the console

Additional context

make_string_header.pass.zip

No response

Bestie123 avatar Aug 03 '22 17:08 Bestie123

The contents of the file https://github.com/llvm/llvm-project/blob/main/libcxx/test/support/test.support/make_string_header.pass.cpp cause the language server to crash.

As a workaround, add this file path to "C_Cpp.files.exclude" setting.

michelleangela avatar Aug 04 '22 21:08 michelleangela

@Bestie123 Is it possible the crash was caused by? : clang\test\parser\parser_overflow.c https://github.com/microsoft/vscode-cpptools/issues/9653

Without that file, I'm able to parse all of the latest code currently in the llvm-project repo. (Though, perhaps there was recent change that removed your repro?).

Colengms avatar Aug 05 '22 02:08 Colengms

@Colengms https://github.com/llvm/llvm-project/releases LLVM 14.06 LLVM 15.0.0-rc1 also tried the current latest copy of the repository

clang\test\parser\parser_overflow.c analyzed without errors

tested on versions of c/c++: 1.10.8, pre release version (1.12.0, 1.11.4, 1.11.3)

but I did not run the analysis of the entire project, but only the clang\test\parser directory

image

in my case, the error is related to the file libcxx\test\support\test.support\make_string_header.pass.cpp and this manifests itself when analyzing a single file or the entire project on version c/c++ 1.11.4, on version 1.10.8 this error does not appear and the entire project is analyzed normally

Bestie123 avatar Aug 05 '22 04:08 Bestie123

@Colengms I tried to run the analysis libcxx\test\support\test.support\make_string_header.pass.cpp on cpptools version 1.12.0, but the analysis also gives an error image

Bestie123 avatar Aug 06 '22 09:08 Bestie123

@sean-mcmanus the error in version 1.12.0 no longer appears during analysis libcxx\test\support\test.support\make_string_header.pass.cpp image

Bestie123 avatar Aug 09 '22 19:08 Bestie123

FYI, 1.11.5 and 1.12.1 have a workaround for this (avoid tag parsing that file), but 1.12.2 should have a real fix.

You may be seeing it fixed in 1.12.0 because it may have saved the parsed state in the database, but it would still crash if the database were reset or if the file was edited/saved.

UPDATE: https://github.com/microsoft/vscode-cpptools/releases/tag/v1.12.2 has a fix for the root crash.

sean-mcmanus avatar Aug 18 '22 20:08 sean-mcmanus