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

IntelliSense process crash detected with co_await. #8678

Closed
Weaverzhu opened this issue Jan 15, 2022 · 20 comments
Closed

IntelliSense process crash detected with co_await. #8678

Weaverzhu opened this issue Jan 15, 2022 · 20 comments
Assignees
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service more info needed The issue report is not actionable in its current state Visual Studio Inherited from Visual Studio
Milestone

Comments

@Weaverzhu
Copy link

Bug type: Language Service

Describe the bug

  • OS and Version: WSL Debian 11 in Win10 19042.1466
  • VS Code Version: 1.63.2
  • C/C++ Extension Version: Version 1.7.1: October 19, 2021
  • Other extensions you installed (and if the issue persists after disabling them):
  • If using SSH remote, specify OS of remote machine:
  • A clear and concise description of what the bug is, including information about the workspace (i.e. is the workspace a single project or multiple projects, size of the project, etc).

Steps to reproduce
analyze fbthrift coroutine code with intellisense

Code sample and logs

  • Code sample

  • Configurations in c_cpp_properties.json

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
            ],
            "defines": ["FOLLY_HAS_COROUTINES=1"],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c17",
            "cppStandard": "c++20",
            "intelliSenseMode": "linux-gcc-x64",
            "compileCommands": "${workspaceFolder}/compile_commands.json"
        }
    ],
    "version": 4
}
  • Logs from running C/C++: Log Diagnostics from the VS Code command palette
-------- Diagnostics - 1/15/2022, 6:41:30 PM
Version: 1.7.1
Current Configuration:
{
    "name": "Linux",
    "includePath": [],
    "defines": [
        "FOLLY_HAS_COROUTINES=1"
    ],
    "compilerPath": "/usr/bin/g++",
    "cStandard": "c17",
    "cppStandard": "c++20",
    "intelliSenseMode": "linux-gcc-x64",
    "compileCommands": "${workspaceFolder}/compile_commands.json",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerArgs": [],
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Translation Unit Mappings:
[ /home/zt/workspace/playground-fb/playground/echo/client.cc ]:
    /home/zt/workspace/playground-fb/playground/echo/client.cc
Translation Unit Configurations:
[ /home/zt/workspace/playground-fb/playground/echo/client.cc ]: not ready
    Process ID: 18630
    Memory Usage: 11 MB
    Compiler Path: /usr/bin/g++
    Includes:
        /home/zt/workspace/playground-fb/build
        /home/zt/workspace/playground-fb
        /home/zt/workspace/playground-fb/build/opt/playground/include
        /usr/include/libiberty
        /usr/include/c++/10
        /usr/include/x86_64-linux-gnu/c++/10
        /usr/include/c++/10/backward
        /usr/lib/gcc/x86_64-linux-gnu/10/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Defines:
        BOOST_ALL_NO_LIB
        BOOST_ATOMIC_DYN_LINK
        BOOST_CONTEXT_DYN_LINK
        BOOST_FILESYSTEM_DYN_LINK
        BOOST_PROGRAM_OPTIONS_DYN_LINK
        BOOST_REGEX_DYN_LINK
        BOOST_SYSTEM_DYN_LINK
        BOOST_THREAD_DYN_LINK
        FMT_LOCALE
        FMT_SHARED
        GFLAGS_IS_A_DLL=0
    Standard Version: c++20
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=100201
    compile_commands.json entry:
        directory: /home/zt/workspace/playground-fb/build
        file: /home/zt/workspace/playground-fb/playground/echo/client.cc
        command: /usr/bin/c++ -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CONTEXT_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DFMT_LOCALE -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -I. -I../ -isystem opt/playground/include -isystem /usr/include/libiberty -g -fsanitize=address -g -O0 -Wno-deprecated -pthread -std=gnu++2a -o playground/echo/CMakeFiles/client.dir/client.cc.o -c /home/zt/workspace/playground-fb/playground/echo/client.cc
Total Memory Usage: 11 MB
Browse Paths from compile_commands.json, from workspace folder: /home/zt/workspace/playground-fb
    /home/zt/workspace/playground-fb
    /home/zt/workspace/playground-fb/build
    /home/zt/workspace/playground-fb/build-fbthrift
    /home/zt/workspace/playground-fb/build-fbthrift/thrift/compiler
    /home/zt/workspace/playground-fb/build-fbthrift/thrift/compiler/generate
    /home/zt/workspace/playground-fb/build-fbthrift/thrift/lib/thrift/gen-cpp2
    /home/zt/workspace/playground-fb/build-folly
    /home/zt/workspace/playground-fb/build/opt/playground/include
    /home/zt/workspace/playground-fb/build/playground/idl/gen-cpp2
    /home/zt/workspace/playground-fb/external/fbthrift
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/ast
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/detail/mustache
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/detail/mustache/state
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/gen/cpp
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/gen/cpp/detail
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/generate
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/lib/cpp2
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/lib/java
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/mutator
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/parse
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/sema
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/compiler/validator
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/async
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/concurrency
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/protocol
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/server
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/transport
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp/util
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/async
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/frozen
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/frozen/schema
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/gen
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/protocol
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/protocol/nimble
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/security
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/security/extensions
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/server
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/server/peeking
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/transport/core
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/transport/rocket
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/transport/rocket/client
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/transport/rocket/framing
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/transport/rocket/server
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/type
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/util
    /home/zt/workspace/playground-fb/external/fbthrift/thrift/lib/cpp2/visitation
    /home/zt/workspace/playground-fb/external/fizz
    /home/zt/workspace/playground-fb/external/fizz/fizz/client
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/aead
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/aead/test
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/exchange
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/hpke
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/openssl
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/signature
    /home/zt/workspace/playground-fb/external/fizz/fizz/crypto/test
    /home/zt/workspace/playground-fb/external/fizz/fizz/experimental/client
    /home/zt/workspace/playground-fb/external/fizz/fizz/experimental/ktls
    /home/zt/workspace/playground-fb/external/fizz/fizz/experimental/protocol
    /home/zt/workspace/playground-fb/external/fizz/fizz/extensions/delegatedcred
    /home/zt/workspace/playground-fb/external/fizz/fizz/extensions/exportedauth
    /home/zt/workspace/playground-fb/external/fizz/fizz/extensions/tokenbinding
    /home/zt/workspace/playground-fb/external/fizz/fizz/protocol
    /home/zt/workspace/playground-fb/external/fizz/fizz/protocol/clock
    /home/zt/workspace/playground-fb/external/fizz/fizz/protocol/ech
    /home/zt/workspace/playground-fb/external/fizz/fizz/protocol/ech/test
    /home/zt/workspace/playground-fb/external/fizz/fizz/record
    /home/zt/workspace/playground-fb/external/fizz/fizz/server
    /home/zt/workspace/playground-fb/external/fizz/fizz/test
    /home/zt/workspace/playground-fb/external/fizz/fizz/tool
    /home/zt/workspace/playground-fb/external/fizz/fizz/util
    /home/zt/workspace/playground-fb/external/folly
    /home/zt/workspace/playground-fb/external/folly/folly
    /home/zt/workspace/playground-fb/external/folly/folly/compression
    /home/zt/workspace/playground-fb/external/folly/folly/concurrency
    /home/zt/workspace/playground-fb/external/folly/folly/container/detail
    /home/zt/workspace/playground-fb/external/folly/folly/detail
    /home/zt/workspace/playground-fb/external/folly/folly/executors
    /home/zt/workspace/playground-fb/external/folly/folly/experimental
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/bser
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/channels
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/coro
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/coro/detail
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/crypto
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/crypto/detail
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/exception_tracer
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/io
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/observer/detail
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/settings
    /home/zt/workspace/playground-fb/external/folly/folly/experimental/symbolizer
    /home/zt/workspace/playground-fb/external/folly/folly/external/farmhash
    /home/zt/workspace/playground-fb/external/folly/folly/fibers
    /home/zt/workspace/playground-fb/external/folly/folly/fibers/async
    /home/zt/workspace/playground-fb/external/folly/folly/fibers/detail
    /home/zt/workspace/playground-fb/external/folly/folly/futures
    /home/zt/workspace/playground-fb/external/folly/folly/futures/detail
    /home/zt/workspace/playground-fb/external/folly/folly/hash
    /home/zt/workspace/playground-fb/external/folly/folly/hash/detail
    /home/zt/workspace/playground-fb/external/folly/folly/init
    /home/zt/workspace/playground-fb/external/folly/folly/io
    /home/zt/workspace/playground-fb/external/folly/folly/io/async
    /home/zt/workspace/playground-fb/external/folly/folly/io/async/ssl
    /home/zt/workspace/playground-fb/external/folly/folly/io/async/test
    /home/zt/workspace/playground-fb/external/folly/folly/io/coro
    /home/zt/workspace/playground-fb/external/folly/folly/lang
    /home/zt/workspace/playground-fb/external/folly/folly/logging
    /home/zt/workspace/playground-fb/external/folly/folly/logging/example
    /home/zt/workspace/playground-fb/external/folly/folly/memory
    /home/zt/workspace/playground-fb/external/folly/folly/memory/detail
    /home/zt/workspace/playground-fb/external/folly/folly/net
    /home/zt/workspace/playground-fb/external/folly/folly/net/detail
    /home/zt/workspace/playground-fb/external/folly/folly/portability
    /home/zt/workspace/playground-fb/external/folly/folly/ssl
    /home/zt/workspace/playground-fb/external/folly/folly/ssl/detail
    /home/zt/workspace/playground-fb/external/folly/folly/stats
    /home/zt/workspace/playground-fb/external/folly/folly/stats/detail
    /home/zt/workspace/playground-fb/external/folly/folly/synchronization
    /home/zt/workspace/playground-fb/external/folly/folly/synchronization/detail
    /home/zt/workspace/playground-fb/external/folly/folly/system
    /home/zt/workspace/playground-fb/external/folly/folly/test
    /home/zt/workspace/playground-fb/external/folly/folly/tracing
    /home/zt/workspace/playground-fb/external/wangle
    /home/zt/workspace/playground-fb/external/wangle/wangle/acceptor
    /home/zt/workspace/playground-fb/external/wangle/wangle/bootstrap
    /home/zt/workspace/playground-fb/external/wangle/wangle/channel
    /home/zt/workspace/playground-fb/external/wangle/wangle/client/persistence
    /home/zt/workspace/playground-fb/external/wangle/wangle/client/ssl
    /home/zt/workspace/playground-fb/external/wangle/wangle/codec
    /home/zt/workspace/playground-fb/external/wangle/wangle/ssl
    /home/zt/workspace/playground-fb/external/wangle/wangle/util
    /home/zt/workspace/playground-fb/playground/echo
    /home/zt/workspace/playground-fb/playground/folly
    /home/zt/workspace/playground-fb/playground/iouring
    /home/zt/workspace/playground-fb/playground/main
    /home/zt/workspace/playground-fb/playground/raw
    /home/zt/workspace/playground-fb/playground/wangle
    /home/zt/workspace/playground-fb/playground/wangle/tutorial
    /home/zt/workspace/playground-fb/test
    /usr/include/libiberty

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

Screenshots

Additional context

Thread 24 "cpptools-srv" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7feb39ffb700 (LWP 18285)]
0x00000000008e2251 in select_overloaded_function(a_symbol*, int, a_template_arg*, int, an_operand*, an_init_component*, an_init_component*, int, int, int, int, an_overload_context, a_source_position*, unsigned int, int*, int*, int*, int*, a_symbol**, an_arg_match_summary**) ()
(gdb) bt
#0  0x00000000008e2251 in select_overloaded_function(a_symbol*, int, a_template_arg*, int, an_operand*, an_init_component*, an_init_component*, int, int, int, int, an_overload_context, a_source_position*, unsigned int, int*, int*, int*, int*, a_symbol**, an_arg_match_summary**) ()
#1  0x000000000093aa51 in init_coroutine_descr(a_routine*, a_coroutine_descr*) ()
#2  0x000000000080173e in get_coroutine_descr(a_routine*) ()
#3  0x000000000078265c in add_await_to_operand(an_operand*, a_source_position*, unsigned int, int, int, int) ()
#4  0x00000000007780d7 in scan_expr_full(an_operand*, an_operand*, int, int) ()
#5  0x0000000000780f48 in scan_expr_as_init_component(int, int) ()
#6  0x000000000076c749 in scan_init_component_with_potential_pack_expansion(a_decl_parse_state*, int, int, int*) ()
#7  0x0000000000781f97 in scan_full_initializer_expr_as_component(a_decl_parse_state*, int, int) ()
#8  0x000000000073dc86 in initializer(a_decl_parse_state*, a_source_position*, an_id_linkage_kind, int, int*, a_decl_pos_block*) ()
#9  0x0000000000733f72 in scan_nonmember_declaration(a_decl_parse_state*, a_source_range*) ()
#10 0x0000000000926b6f in decl_statement(int, int*) ()
@sean-mcmanus
Copy link
Contributor

Do you have a code sample? It looks like it's some code using await/coroutines.

@sean-mcmanus
Copy link
Contributor

i.e. can you provide more repro details? Is it from https://github.com/facebook/fbthrift ? What branch? Any other info on how to get a minimum repro would be helpful.

@sean-mcmanus sean-mcmanus added bug Language Service more info needed The issue report is not actionable in its current state Visual Studio Inherited from Visual Studio labels Jan 18, 2022
@sean-mcmanus sean-mcmanus changed the title IntelliSense process crash detected. IntelliSense process crash detected with co_await. Jan 18, 2022
@Weaverzhu
Copy link
Author

Thanks for responding. I'm still new to fbthrift coro rpc calls. The crash will happen when opening a generated .h file by fbthrift compiler, and the code still has some compilation error.

I also played with folly (a dependency of fbthrift) coroutines, everything is fine. Maybe this issue is associated with fbthrift.

I'm prepare a repo for reproducing this issue. Maybe I can provide a cmake project in a few days (trying to make a minimal example after returning from work).

@Weaverzhu
Copy link
Author

@sean-mcmanus hi, i've made a repo with some detailed steps to reproduce this bug. plz let me know if there is anything else you need for analyzing.

here's another stack trace, it should be the same as before

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
--Type <RET> for more, q to quit, c to continue without paging--
futex_abstimed_wait_cancelable (private=0, abstime=0x7ffc064f6ad8, clockid=105867872, expected=0, futex_word=0xfc1258 <g_eventAbort+80>) at ../sysdeps/nptl/futex-internal.h:323
323     ../sysdeps/nptl/futex-internal.h: No such file or directory.
(gdb) bt
#0  futex_abstimed_wait_cancelable (private=0, abstime=0x7ffc064f6ad8, clockid=105867872, expected=0, futex_word=0xfc1258 <g_eventAbort+80>) at ../sysdeps/nptl/futex-internal.h:323
#1  __pthread_cond_wait_common (abstime=0x7ffc064f6ad8, clockid=105867872, mutex=0xfc1208 <g_eventAbort>, cond=0xfc1230 <g_eventAbort+40>) at pthread_cond_wait.c:520
#2  __pthread_cond_timedwait (cond=0xfc1230 <g_eventAbort+40>, mutex=0xfc1208 <g_eventAbort>, abstime=0x7ffc064f6ad8) at pthread_cond_wait.c:656
#3  0x00000000005c285a in bool std::condition_variable::wait_for<long, std::ratio<1l, 1l>, msvc::event_t::wait_for<long, std::ratio<1l, 1l> >(std::chrono::duration<long, std::ratio<1l, 1l> > const&)::{lambda()#1}>(std::unique_lock<std::mutex>&, std::chrono::duration<long, std::ratio<1l, 1l> > const&, msvc::event_t::wait_for<long, std::ratio<1l, 1l> >(std::chrono::duration<long, std::ratio<1l, 1l> > const&)::{lambda()#1}) ()
#4  0x00000000005b8706 in bool msvc::event_t::wait_for<long, std::ratio<1l, 1l> >(std::chrono::duration<long, std::ratio<1l, 1l> > const&) ()
#5  0x00000000005b4456 in RunServer(unsigned int, char const*) ()
#6  0x00000000005b4a62 in main ()
(gdb) c
Continuing.

Thread 24 "cpptools-srv" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f773affd700 (LWP 4498)]
0x00000000008e2251 in select_overloaded_function(a_symbol*, int, a_template_arg*, int, an_operand*, an_init_component*, an_init_component*, int, int, int, int, an_overload_context, a_source_position*, unsigned int, int*, int*, int*, int*, a_symbol**, an_arg_match_summary**) ()
(gdb) bt
#0  0x00000000008e2251 in select_overloaded_function(a_symbol*, int, a_template_arg*, int, an_operand*, an_init_component*, an_init_component*, int, int, int, int, an_overload_context, a_source_position*, unsigned int, int*, int*, int*, int*, a_symbol**, an_arg_match_summary**) ()
#1  0x000000000093aa51 in init_coroutine_descr(a_routine*, a_coroutine_descr*) ()
#2  0x000000000080173e in get_coroutine_descr(a_routine*) ()
#3  0x000000000078265c in add_await_to_operand(an_operand*, a_source_position*, unsigned int, int, int, int) ()
#4  0x00000000007780d7 in scan_expr_full(an_operand*, an_operand*, int, int) ()
#5  0x0000000000780f48 in scan_expr_as_init_component(int, int) ()
#6  0x000000000076c749 in scan_init_component_with_potential_pack_expansion(a_decl_parse_state*, int, int, int*) ()
#7  0x0000000000781f97 in scan_full_initializer_expr_as_component(a_decl_parse_state*, int, int) ()
#8  0x000000000073dc86 in initializer(a_decl_parse_state*, a_source_position*, an_id_linkage_kind, int, int*, a_decl_pos_block*) ()
#9  0x0000000000733f72 in scan_nonmember_declaration(a_decl_parse_state*, a_source_range*) ()
#10 0x0000000000926b6f in decl_statement(int, int*) ()
#11 0x0000000000925385 in statement(int, int) ()
#12 0x0000000000921708 in compound_statement_full(int, int, int, int, int, a_type**) ()
#13 0x00000000007fd3e6 in scan_function_body(a_routine*, a_func_info_block*, unsigned long, a_macro_arg_fixup**, a_macro_arg_fixup**) ()
#14 0x000000000094edd3 in function_prototype_instantiation(a_symbol*) ()

@sean-mcmanus sean-mcmanus added investigate: repro This issue's repro steps needs to be investigated/confirmed and removed more info needed The issue report is not actionable in its current state labels Jan 21, 2022
@sean-mcmanus sean-mcmanus added this to the 1.8.x milestone Jan 21, 2022
@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jan 21, 2022

I get a build error: fbthrift-playground/external/fbthrift/thrift/lib/cpp/ContextStack.cpp:229:5: error: no matching function for call to 'operator delete' . Do you know how to resolve that?

As an alternative, can you generate a preprocessed file using a command that matches how the repro file is compiled by IntelliSense but with -E -dD added, i.e. /usr/bin/g++ -std=gnu++2a -E -dD -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CONTEXT_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DFMT_LOCALE -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -I/home/zt/workspace/playground-fb/build -I/home/zt/workspace/playground-fb -I/home/zt/workspace/playground-fb/build/opt/playground/include -I/usr/include/libiberty /home/zt/workspace/playground-fb/playground/echo/client.cc > /home/zt/workspace/playground-fb/playground/echo/client.out.cc

and verify that it still repros the crash?

UPDATE: I previously mentioned using -dM but it actually needs to be -dD.

@Weaverzhu
Copy link
Author

What compiler did you used? I saw this error when i'm using clang-11. GCC 10.2 on Debian 11 should be ok.

@sean-mcmanus
Copy link
Contributor

Looks like it's using clang 10, gcc 10.3 libraries. Should I try switching to gcc or clang 11?

@Weaverzhu
Copy link
Author

Weaverzhu commented Jan 22, 2022

Looks like it's using clang 10, gcc 10.3 libraries. Should I try switching to gcc or clang 11?

gcc 10.3 should be ok.

I also generated two files using the commands above. It seems not to be a cpp files and recognized by intellisense. I also tried adding add_compile_options in CMakeList.txt, but the whole project would meet a compiliation failure.

[8/11] Building CXX object playground/echo/CMakeFiles/client.dir/client.cc.o
FAILED: playground/echo/CMakeFiles/client.dir/client.cc.o 
/usr/bin/c++ -D-E -D-dD -DBOOST_ALL_NO_LIB -DBOOST_ATOMIC_DYN_LINK -DBOOST_CONTEXT_DYN_LINK -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_REGEX_DYN_LINK -DBOOST_SYSTEM_DYN_LINK -DBOOST_THREAD_DYN_LINK -DFMT_LOCALE -DFMT_SHARED -DGFLAGS_IS_A_DLL=0 -I. -I../ -isystem opt/playground/include -isystem /usr/include/libdwarf -isystem /usr/include/libiberty -Wno-deprecated -pthread -std=gnu++2a -MD -MT playground/echo/CMakeFiles/client.dir/client.cc.o -MF playground/echo/CMakeFiles/client.dir/client.cc.o.d -o playground/echo/CMakeFiles/client.dir/client.cc.o -c ../playground/echo/client.cc
<command-line>: error: macro names must be identifiers
<command-line>: error: macro names must be identifiers

Anyway the generated files are a little big (more than 40w lines), and I uploaded here

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jan 22, 2022

Okay, I got it to build with gcc, but I don't have a build/playground folder -- is there a step missing?

It seems like you generated the precompiled file correctly, but it's giant sized so the IntelliSense process is really slow to process it, so I'm not sure if it's reproing the bug yet. (Although the -D-D and -D-D in your logging is supposed to be "just -E and -dD" without the -D). The "not a cpp file" is probably due to the extension (it should be named something like test.out.cpp and my initial response incorrectly had a space after the 1st dot).

I'll follow up on Monday...

@Weaverzhu
Copy link
Author

Okay, I got it to build with gcc, but I don't have a build/playground folder -- is there a step missing?

from ./scripts/build.sh

#!/bin/bash
set -eux
CWD=$(dirname $0)/..
cd $CWD

if [ $1 == deps ] 
then
    echo building deps...
    source ./scripts/build-deps.sh
fi

cd build
cmake .. -GNinja
ninja

If all depencies are successfully built you can cd build; cmake .. -GNinja; ninja to build the final project. But the script should have already done the job. Do you need a Dockerfile to directly reproduce the bug? (so you may also have to use the remote-container extension)

Anyway happy weekends :)

@sean-mcmanus
Copy link
Contributor

sean-mcmanus commented Jan 24, 2022

The preprocessed file isn't reproing the crash -- I'm not seeing any co_await calls in the file so it appears to be generated incorrectly...maybe you need -fcoroutines in the command line? Also, FOLLY_HAS_COROUTINES is 0, which doesn't match your previous "define".

I get this error still when running cmake. Do you know what do about that?

CMake Error at CMakeLists.txt:52 (find_package):
  By not providing "Findglog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glog", but
  CMake did not find one.

  Could not find a package configuration file provided by "glog" with any of
  the following names:

    glogConfig.cmake
    glog-config.cmake

  Add the installation prefix of "glog" to CMAKE_PREFIX_PATH or set
  "glog_DIR" to a directory containing one of the above files.  If "glog"
  provides a separate development package or SDK, be sure it has been
  installed.

@bobbrow bobbrow modified the milestones: 1.8.x, On Deck Jan 25, 2022
@Weaverzhu
Copy link
Author

Hi, sry for the late response. I've update a new method in the previous repo using docker and remote-containers to build the whole project, should be useful if there's some difference between dev environments. (I'm guessing you are running Ubuntu?).

The crash should be reproduced in this container, with the same stack trace.

@sean-mcmanus sean-mcmanus assigned Colengms and unassigned sean-mcmanus Feb 1, 2022
@Colengms
Copy link
Contributor

Hi @Weaverzhu . Using the repo you provided, I'm able to reproduce the crash in select_overloaded_function.

The issue indeed appears to be related to coroutines, given the stack of the crash. Our next step will be to try to narrow it down further, to reduce it to something more manageable for our IntelliSense developers to investigate.

@Colengms Colengms modified the milestones: On Deck, Backlog Feb 15, 2022
@66maer
Copy link

66maer commented Mar 1, 2022

I have the same issue.

I used this library:https://github.com/seqan/seqan

When I include this header, send crashes:

#include <seqan3/alignment/pairwise/align_pairwise.hpp>

The following is the call stack

Thread 17 "cpptools-srv" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f8742ffd700 (LWP 44992)]
0x000000000095b636 in push_pack_instantiation(a_pack_expansion_descr*, a_template_param*, a_template_arg*, int, int, int, a_ctws_state*, int*) ()
(gdb) bt
#0  0x000000000095b636 in push_pack_instantiation(a_pack_expansion_descr*, a_template_param*, a_template_arg*, int, int, int, a_ctws_state*, int*) ()
#1  0x000000000095c194 in begin_pack_deduction_context(a_pack_expansion_descr*, a_template_param*, a_template_arg**, a_pack_expansion_stack_entry**) ()
#2  0x00000000009b44a4 in matches_template_arg_list(a_template_arg*, a_template_arg*, a_template_arg**, a_template_param*, unsigned int) ()
#3  0x00000000009969be in matches_template_type_for_class_type(a_type*, a_type*, a_template_arg**, a_template_param*, unsigned int) ()
#4  0x000000000099572a in matches_template_type(a_type*, a_type*, a_template_arg**, a_template_param*, unsigned int) ()
#5  0x000000000093e893 in deduce_from_one_pair(a_type*, a_type*, a_type*, a_type*, a_template_arg**, a_template_param*) ()
#6  0x0000000000941340 in deduce_one_parameter(a_param_type*, a_type*, an_init_component**, a_type*, a_symbol*, a_template_arg**) ()
#7  0x0000000000940091 in determine_function_viability(a_symbol*, a_symbol*, int, a_template_arg*, a_symbol*, a_type*, an_init_component*, int, an_operand*, a_type*, int, int, int, int, int, int, int, int, int, int, an_overload_context, a_candidate_function**, int*, int*, int*, int*) ()
#8  0x000000000091fb10 in try_overloaded_function_match(a_symbol*, int, a_template_arg*, an_init_component*, an_init_component*, int, an_operand*, int, int, int, int, int, int, int, int, int, int, an_overload_context, a_candidate_function**, a_symbol**, int*, int*, int*) ()
#9  0x0000000000920ce2 in select_overloaded_function(a_symbol*, int, a_template_arg*, int, an_operand*, an_init_component*, an_init_component*, int, int, int, int, an_overload_context, a_source_position*, unsigned int, int*, int*, int*, int*, a_symbol**, an_arg_match_summary**) ()
#10 0x000000000093d9a7 in deduce_class_template_args(a_type*, int, int, int, an_init_component*, a_source_position*, a_type**, int*) ()
#11 0x000000000078a7ce in deduce_placeholder_type(int, int, int, int, a_type*, a_type*, int, an_operand*, an_init_component*, a_source_position*, a_type**, a_type**, int*) ()
#12 0x000000000078afba in prescan_initializer_for_auto_type_deduction(a_decl_parse_state*, int) ()
#13 0x000000000075a04d in initializer(a_decl_parse_state*, a_source_position*, an_id_linkage_kind, int, int*, a_decl_pos_block*) ()
#14 0x0000000000750cd7 in scan_nonmember_declaration(a_decl_parse_state*, a_source_range*) ()
#15 0x000000000075447a in namespace_declaration(a_token_kind_tag*, int, int, a_source_position*, a_symbol**) ()
#16 0x000000000075438d in namespace_declaration(a_token_kind_tag*, int, int, a_source_position*, a_symbol**) ()
#17 0x000000000074bfcb in scan_nonmember_declaration(a_decl_parse_state*, a_source_range*) ()
#18 0x00000000007521e8 in translation_unit() ()
#19 0x00000000009cf7f4 in process_translation_unit(char const*, int, an_exported_template_file*) ()
#20 0x00000000006a73b7 in cfe_main(int, char**) ()
#21 0x00000000009f3e36 in cfe_main_exception_handler(int, char**) ()
#22 0x00000000006a74b6 in edg_main(int, char**) ()
#23 0x00000000009ed1cc in edge_compiler_main(int, char const**) ()
#24 0x00000000006333b6 in preparse(int, char const**, a_scout_store*, edge::translation_unit*) ()
#25 0x00000000005f87ef in a_compiler_thread::compiler_thread_routine(a_compiler_thread*) ()
#26 0x0000000000adbb0a in msvc::thread_helper_t::thread_entry(void*) ()
#27 0x00007f8753217609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#28 0x00007f875313e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

I'm a beginner, and I can't help you with debugging such a complex project. I hope the information I provide can help you locate the problem.

@sean-mcmanus
Copy link
Contributor

@66maer Your crash appears to be different -- I've moved it to #8956 .

@Colengms
Copy link
Contributor

Hi @Weaverzhu . I had been able to repro this, but revisiting this recently, I can't seem to get your example repo to configure/build. Are you still able to repro this using the repo you provided?

@Colengms Colengms added the more info needed The issue report is not actionable in its current state label May 18, 2022
@Weaverzhu
Copy link
Author

Weaverzhu commented Jun 2, 2022

Hi @Weaverzhu . I had been able to repro this, but revisiting this recently, I can't seem to get your example repo to configure/build. Are you still able to repro this using the repo you provided?

Sorry for the late reply.

I can't seem to get your example repo to configure/build.

Yes, it cannot build indeed. The code would meet a build failure, but the idl code generated (part of the building process) is still able to trigger the coredump. At that time I want to find out the reason of the build failure, the intellisense might help to check if there was any syntax incompatibility. Later I found it needs -stdlib=libc++ to use fbthrift coroutines.

Anyway since apt repo supports prebuilt only in -stdlib=libstdc++, I give up trying to use fbthrift coro for now. And perhaps it's not a good minimal reproduce for you to analysis, so feel free to close this issue. Thanks for the help anyway.

@sean-mcmanus
Copy link
Contributor

@Colengms Did you want to close this or attempt to repro the crash with the scenario where it doesn't build?

@microsoft microsoft deleted a comment from 66maer Jun 21, 2022
@microsoft microsoft deleted a comment from 66maer Jun 21, 2022
@github-actions
Copy link

This issue has been closed because it needs more information and has not had recent activity.

@66maer
Copy link

66maer commented Aug 21, 2022 via email

@github-actions github-actions bot locked and limited conversation to collaborators Oct 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug investigate: repro This issue's repro steps needs to be investigated/confirmed Language Service more info needed The issue report is not actionable in its current state Visual Studio Inherited from Visual Studio
Projects
None yet
Development

No branches or pull requests

5 participants