microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.46k stars 1.53k forks source link

problems while parsing boost-library headers #12698

Open tlik opened 1 week ago

tlik commented 1 week ago

Environment

Bug Summary and Steps to Reproduce

The problem occurs when I add "boost/accumulators" headers (boost version 1.81) and try to use some stuff. From this moment on, the "C/C++" extension hangs in the "project scanning" mode (tooltips, auto-completion, auto-formatting stop working). At the same time, I see that the cpptools-srv process memory consumption is constantly growing (can eat 20 gigabytes in less than a minute).

This issue can be reproduced with the following simple test project

#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/mean.hpp>

int main() {
   using namespace boost::accumulators;
   accumulator_set<double, features<tag::mean>> accumulator;
}

Configuration and Logs

 // c_cpp_properties.json
{
  "configurations": [
    {
      "name": "Linux",
      "includePath": [
        "${workspaceFolder}/**",
        "/usr/local/include/",
        "/usr/local/include/**"
      ],
      "defines": [
        "BOOST_ASIO_HAS_CO_AWAIT",
        "BOOST_ASIO_HAS_STD_COROUTINE"
      ],
      "compilerPath": "/usr/bin/gcc-10",
      "intelliSenseMode": "gcc-x64"
    }
  ],
  "version": 4
}
# logs
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp (id: 33)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 32)
LSP: (received) textDocument/willSaveWaitUntil: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp (id: 34)
LSP: (invoked) textDocument/willSaveWaitUntil: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp (id: 34)
LSP: Sending response (id: 34)
willSaveWaitUntil: 0ms
LSP: (received) textDocument/didSave: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp
LSP: (received) cpptools/fileChanged: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp (id: 35)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 33)
LSP: Message ignored due to no registered handler: $/setTrace
LSP: (received) cpptools/didChangeSettings
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: $/cancelRequest (cpptools/getCodeActions, id: 35)
LSP: (received) textDocument/definition: file:///home/anatoliyrodionov/xdev/playground/cpp/test/main.cpp (id: 36)
LSP: $/cancelRequest (cpptools/getFoldingRanges, id: 28)

Other Extensions

No response

Additional context

No response

bobbrow commented 3 days ago

Hi @tlik,

I just tried to reproduce this issue on Ubuntu 22.04 (with boost 1.86.0) and was unsuccessful. I'll try again with an older version of Boost, but if there anything else going on in your workspace that you can share to help us see the issue, please let us know.

Please also note that the extension should already be adding /usr/local/include to the includePath based on the compiler you selected (gcc-10). You should remove those from your configuration.

bobbrow commented 3 days ago

I was also unable to reproduce the issue with Boost 1.81.0.