clangd / clangd

clangd language server
https://clangd.llvm.org
Apache License 2.0
1.54k stars 65 forks source link

Ubuntu Jammy Nightly releases crash with SublimeText LSP-clangd #2151

Closed fruffy closed 1 month ago

fruffy commented 1 month ago

I have been running into crashes with SublimeText LSP. I am using the latest Ubuntu Jammy nightly release. This issue has started about two weeks ago. https://llvm-jenkins.debian.net/view/Ubuntu%20Jammy/builds

System information

Output of clangd --version: Ubuntu clang version 20.0.0 (++20240921053711+f760db124972-1~exp1~20240921053840.1941) Target: x86_64-pc-linux-gnu Thread model: posix Features: linux+grpc Platform: x86_64-pc-linux-gnu

Editor/LSP plugin:

SublimeLSP

Operating system:

Operating System: Pop!_OS 22.04 LTS                 
Kernel: Linux 6.9.3-76060903-generic

This is the current output I am seeing. I will try to provide more detail if I can find it.

clangd: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
clangd:  #0 0x0000766d0b980a96 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf80a96)
clangd:  #1 0x0000766d0b97e690 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf7e690)
clangd:  #2 0x0000766d0b98114b (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8114b)
clangd:  #3 0x0000766d09a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
clangd:  #4 0x0000766d0b920e1d llvm::StringMapImpl::LookupBucketFor(llvm::StringRef, unsigned int) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf20e1d)
clangd:  #5 0x000061a1b9c4299c (/usr/bin/clangd+0x65899c)
clangd:  #6 0x000061a1b9c410ca (/usr/bin/clangd+0x6570ca)
clangd:  #7 0x000061a1ba24b91b (/usr/bin/clangd+0xc6191b)
clangd:  #8 0x000061a1b99c8867 (/usr/bin/clangd+0x3de867)
clangd:  #9 0x000061a1b9a6b5bc (/usr/bin/clangd+0x4815bc)
clangd: #10 0x000061a1b9a6afc4 (/usr/bin/clangd+0x480fc4)
clangd: #11 0x000061a1b9a679cc (/usr/bin/clangd+0x47d9cc)
clangd: #12 0x000061a1b9a6761f (/usr/bin/clangd+0x47d61f)
clangd: #13 0x000061a1b9bca9ba (/usr/bin/clangd+0x5e09ba)
clangd: #14 0x0000766d09a94ac3 start_thread ./nptl/pthread_create.c:442:8
clangd: #15 0x0000766d09b26850 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:83:0
clangd: Signalled during AST worker action: Build AST
clangd:   Filename: reference_checker.cpp
clangd:   Directory: p4c/build
clangd:   Command Line: /usr/lib/llvm-20/bin/clang++ --driver-mode=g++ -DBOOST_CONTAINER_NO_LIB -DBOOST_CONTAINER_STATIC_LINK -DBOOST_IOSTREAMS_NO_LIB -DBOOST_IOSTREAMS_STATIC_LINK -DBOOST_RANDOM_NO_LIB -DBOOST_RANDOM_STATIC_LINK -DCONFIG_PKGDATADIR="/usr/local/share/p4c" -DCONFIG_PREFIX="/usr/local" -DGC_USE_DLOPEN_WRAP -DMAX_LOGGING_LEVEL=10 -DP4C_GTEST_ENABLED -DSKIP_CPP_DEFINITIONS -D_GNU_SOURCE -Ip4c/build/control-plane -Ip4c -Ip4c/build -Ip4c/extensions -Ip4c/build/backends/p4tools/modules/flay/core/control_plane -Ip4c/build/backends/p4tools/common/control_plane -Ip4c/build/_deps/protobuf-src/src -Ip4c/build/_deps/bdwgc-src/include -isystem p4c/build/_deps/gtest-src/googlemock/include -isystem p4c/build/_deps/gtest-src/googletest/include -isystem p4c/build/_deps/z3-src/src/api -isystem p4c/build/_deps/z3-src/src/api/c++ -isystem p4c/build/_deps/abseil-src -isystem p4c/build/_deps/boost-src/libs/iostreams/include -isystem p4c/build/_deps/boost-src/libs/assert/include -isystem p4c/build/_deps/boost-src/libs/config/include -isystem p4c/build/_deps/boost-src/libs/core/include -isystem p4c/build/_deps/boost-src/libs/static_assert/include -isystem p4c/build/_deps/boost-src/libs/throw_exception/include -isystem p4c/build/_deps/boost-src/libs/detail/include -isystem p4c/build/_deps/boost-src/libs/preprocessor/include -isystem p4c/build/_deps/boost-src/libs/type_traits/include -isystem p4c/build/_deps/boost-src/libs/function/include -isystem p4c/build/_deps/boost-src/libs/bind/include -isystem p4c/build/_deps/boost-src/libs/integer/include -isystem p4c/build/_deps/boost-src/libs/iterator/include -isystem p4c/build/_deps/boost-src/libs/concept_check/include -isystem p4c/build/_deps/boost-src/libs/function_types/include -isystem p4c/build/_deps/boost-src/libs/mpl/include -isystem p4c/build/_deps/boost-src/libs/predef/include -isystem p4c/build/_deps/boost-src/libs/utility/include -isystem p4c/build/_deps/boost-src/libs/io/include -isystem p4c/build/_deps/boost-src/libs/fusion/include -isystem p4c/build/_deps/boost-src/libs/container_hash/include -isystem p4c/build/_deps/boost-src/libs/describe/include -isystem p4c/build/_deps/boost-src/libs/mp11/include -isystem p4c/build/_deps/boost-src/libs/tuple/include -isystem p4c/build/_deps/boost-src/libs/typeof/include -isystem p4c/build/_deps/boost-src/libs/functional/include -isystem p4c/build/_deps/boost-src/libs/optional/include -isystem p4c/build/_deps/boost-src/libs/move/include -isystem p4c/build/_deps/boost-src/libs/smart_ptr/include -isystem p4c/build/_deps/boost-src/libs/random/include -isystem p4c/build/_deps/boost-src/libs/array/include -isystem p4c/build/_deps/boost-src/libs/dynamic_bitset/include -isystem p4c/build/_deps/boost-src/libs/range/include -isystem p4c/build/_deps/boost-src/libs/conversion/include -isystem p4c/build/_deps/boost-src/libs/regex/include -isystem p4c/build/_deps/boost-src/libs/system/include -isystem p4c/build/_deps/boost-src/libs/variant2/include -isystem p4c/build/_deps/boost-src/libs/winapi/include -isystem p4c/build/_deps/boost-src/libs/format/include -isystem p4c/build/_deps/boost-src/libs/multiprecision/include -isystem p4c/build/_deps/boost-src/libs/lexical_cast/include -isystem p4c/build/_deps/boost-src/libs/container/include -isystem p4c/build/_deps/boost-src/libs/intrusive/include -isystem p4c/build/_deps/boost-src/libs/math/include -fdiagnostics-color=never -Wall -Wextra -Wno-overloaded-virtual -Wno-deprecated -Wno-deprecated-declarations -pedantic -Wno-gnu-zero-variadic-macro-arguments -O2 -g -DNDEBUG -fPIE -std=gnu++17 -o backends/p4tools/modules/flay/tools/CMakeFiles/flay_reference_checker.dir/reference_checker.cpp.o -c -resource-dir=/usr/lib/llvm-20/lib/clang/20 -- reference_checker.cpp
clangd:   Version: 0
fruffy commented 1 month ago

More errors:

clangd:  #0 0x000072c769b8ed36 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8ed36)
clangd:  #1 0x000072c769b8c930 llvm::sys::RunSignalHandlers() (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8c930)
clangd:  #2 0x000072c769b8f3eb (/usr/lib/llvm-20/bin/../lib/libLLVM.so.20.0+0xf8f3eb)
clangd:  #3 0x000072c767c42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
clangd:  #4 0x000072c771c09fcb clang::Lexer::SkipWhitespace(clang::Token&, char const*, bool&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc09fcb)
clangd:  #5 0x000072c771c0d40c clang::Lexer::LexTokenInternal(clang::Token&, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc0d40c)
clangd:  #6 0x000072c771c6accd clang::Preprocessor::Lex(clang::Token&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc6accd)
clangd:  #7 0x000072c771c30865 clang::Preprocessor::CachingLex(clang::Token&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc30865)
clangd:  #8 0x000072c771c30c76 (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc30c76)
clangd:  #9 0x000072c771c6accd clang::Preprocessor::Lex(clang::Token&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc6accd)
clangd: #10 0x000072c771c785c9 (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc785c9)
clangd: #11 0x000072c771d25bd7 clang::Parser::ExpectAndConsume(clang::tok::TokenKind, unsigned int, llvm::StringRef) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xd25bd7)
clangd: #12 0x000072c771ca292f clang::Parser::ParseAliasDeclarationAfterDeclarator(clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::Parser::UsingDeclarator&, clang::SourceLocation&, clang::AccessSpecifier, clang::ParsedAttributes&, clang::Decl**) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xca292f)
clangd: #13 0x000072c771ca1714 clang::Parser::ParseUsingDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation, clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xca1714)
clangd: #14 0x000072c771ca0b66 clang::Parser::ParseUsingDirectiveOrDeclaration(clang::DeclaratorContext, clang::Parser::ParsedTemplateInfo const&, clang::SourceLocation&, clang::ParsedAttributes&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xca0b66)
clangd: #15 0x000072c771c852a5 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc852a5)
clangd: #16 0x000072c771d292ef clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xd292ef)
clangd: #17 0x000072c771c9fb7b clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc9fb7b)
clangd: #18 0x000072c771c9fc85 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc9fc85)
clangd: #19 0x000072c771c9fc85 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc9fc85)
clangd: #20 0x000072c771c9f69d clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc9f69d)
clangd: #21 0x000072c771c8539e clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc8539e)
clangd: #22 0x000072c771d292ef clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xd292ef)
clangd: #23 0x000072c771d28267 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xd28267)
clangd: #24 0x000072c771d27cdf clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xd27cdf)
clangd: #25 0x000072c771c72393 clang::ParseAST(clang::Sema&, bool, bool) (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0xc72393)
clangd: #26 0x000072c773d68855 clang::FrontendAction::Execute() (/lib/x86_64-linux-gnu/libclang-cpp.so.20.0+0x2d68855)
clangd: #27 0x000055e71b1a9cc3 (/usr/bin/clangd+0x3dfcc3)
clangd: #28 0x000055e71b24b6cc (/usr/bin/clangd+0x4816cc)
clangd: #29 0x000055e71b24b0d4 (/usr/bin/clangd+0x4810d4)
clangd: #30 0x000055e71b247adc (/usr/bin/clangd+0x47dadc)
clangd: #31 0x000055e71b24772f (/usr/bin/clangd+0x47d72f)
clangd: #32 0x000055e71b3ad68a (/usr/bin/clangd+0x5e368a)
clangd: #33 0x000072c767c94ac3 start_thread ./nptl/pthread_create.c:442:8
clangd: #34 0x000072c767d26850 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:83:0
clangd: Signalled during AST worker action: Build AST
HighCommander4 commented 1 month ago

Are you able to share a code example that triggers the crash?

fruffy commented 1 month ago

Unfortunately, this seems to happen with any file of the project. When I try to perform individual checks using something like clangd --check=prog.cpp --compile-commands-dir build/ I am not seeing the crash.

Unclear how to best debug this...

HighCommander4 commented 1 month ago

It's a bit strange that in the backtraces, stack frames from the clang libraries are symbolized but stack frames from clangd itself are not.

Could you try with the latest weekly snapshot from our releases page (https://github.com/clangd/clangd/releases/tag/snapshot_20240915), to see if (1) the crash occurs in that build and (2) maybe it gives a more useful backtrace?

fruffy commented 1 month ago

This is what I am seeing with the snapshot binary:

clangd: PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
clangd: I[11:30:14.540] Indexed c++17 standard library (incomplete due to errors): 13656 symbols, 1814 filtered
clangd:  #0 0x0000000000556f6b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
clangd:  #1 0x0000000000554dbe llvm::sys::RunSignalHandlers() /__w/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:106:18
clangd:  #2 0x0000000000557906 SignalHandler(int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
clangd:  #3 0x00007ef718642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
clangd:  #4 0x000000000051e8c1 llvm::StringMapImpl::LookupBucketFor(llvm::StringRef, unsigned int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/StringMap.cpp:102:38
clangd:  #5 0x000000000397b38c std::pair<llvm::StringMapIterator<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>>, bool> llvm::StringMap<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, llvm::MallocAllocator>::try_emplace_with_hash<llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&>(llvm::StringRef, unsigned int, llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>&) /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/StringMap.h:376:25
clangd:  #6 0x000000000397b211 clang::tidy::boost::UseRangesCheck::getReplacerMap() const::$_0::operator()(llvm::IntrusiveRefCntPtr<clang::tidy::utils::UseRangesCheck::Replacer>, std::initializer_list<llvm::StringRef>, llvm::StringRef) const /__w/clangd/clangd/llvm-project/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:211:31
clangd:  #7 0x0000000003979d04 release /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:232:9
clangd:  #8 0x0000000003979d04 ~IntrusiveRefCntPtr /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/IntrusiveRefCntPtr.h:196:27
clangd:  #9 0x0000000003979d04 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:220:9
clangd: #10 0x0000000003979d04 clang::tidy::boost::UseRangesCheck::getReplacerMap() const /__w/clangd/clangd/llvm-project/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp:234:3
clangd: #11 0x000000000401c2ed clang::tidy::utils::UseRangesCheck::registerMatchers(clang::ast_matchers::MatchFinder*) /__w/clangd/clangd/llvm-project/clang-tools-extra/clang-tidy/utils/UseRangesCheck.cpp:112:23
clangd: #12 0x0000000001759591 operator++ /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/stl_iterator.h:805:2
clangd: #13 0x0000000001759591 clang::clangd::ParsedAST::build(llvm::StringRef, clang::clangd::ParseInputs const&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, llvm::ArrayRef<clang::clangd::Diag>, std::shared_ptr<clang::clangd::PreambleData const>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/ParsedAST.cpp:563:28
clangd: #14 0x00000000017e06d5 ~__shared_count /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/shared_ptr_base.h:683:6
clangd: #15 0x00000000017e06d5 ~__shared_ptr /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/shared_ptr_base.h:1123:31
clangd: #16 0x00000000017e06d5 clang::clangd::(anonymous namespace)::ASTWorker::generateDiagnostics(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1210:39
clangd: #17 0x00000000017e016b clang::clangd::(anonymous namespace)::ASTWorker::updatePreamble(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::shared_ptr<clang::clangd::PreambleData const>, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>, clang::clangd::WantDiagnostics)::$_2::operator()() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1144:5
clangd: #18 0x00000000017dc9e3 operator() /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
clangd: #19 0x00000000017dc9e3 clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref<void ()>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1324:3
clangd: #20 0x00000000017db4a0 run /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:1459:5
clangd: #21 0x00000000017db4a0 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/TUScheduler.cpp:822:42
clangd: #22 0x00000000017db4a0 void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::(anonymous namespace)::ASTWorker::create(llvm::StringRef, clang::clangd::GlobalCompilationDatabase const&, clang::clangd::TUScheduler::ASTCache&, clang::clangd::TUScheduler::HeaderIncluderCache&, clang::clangd::AsyncTaskRunner*, clang::clangd::Semaphore&, clang::clangd::TUScheduler::Options const&, clang::clangd::ParsingCallbacks&)::$_7>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:222:12
clangd: #23 0x000000000195da96 operator= /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:48:5
clangd: #24 0x000000000195da96 PunnedPointer /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:37:60
clangd: #25 0x000000000195da96 PointerIntPair /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:86:13
clangd: #26 0x000000000195da96 UniqueFunctionBase /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:343:3
clangd: #27 0x000000000195da96 unique_function /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:372:3
clangd: #28 0x000000000195da96 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:103:14
clangd: #29 0x000000000195da96 operator()<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:43:11
clangd: #30 0x000000000195da96 __invoke_impl<void, (lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), (lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:60:14
clangd: #31 0x000000000195da96 __invoke<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), (lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/invoke.h:95:14
clangd: #32 0x000000000195da96 __apply_impl<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> &, 0> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/tuple:1662:14
clangd: #33 0x000000000195da96 apply<(lambda at /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:42:9), std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> &> /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/tuple:1671:14
clangd: #34 0x000000000195da96 GenericThreadProxy<std::tuple<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15)> > /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:41:5
clangd: #35 0x000000000195da96 void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:55:5
clangd: #36 0x00007ef718694ac3 start_thread ./nptl/pthread_create.c:442:8
clangd: #37 0x00007ef718726850 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:83:0
clangd: Signalled during AST worker action: Build AST
clangd:   Filename: p4c/backends/p4tools/modules/flay/flay.cpp
clangd:   Directory: p4c/build
clangd:   Command Line: /usr/lib/llvm-20/bin/clang++ --driver-mode=g++ -DBOOST_CONTAINER_NO_LIB -DBOOST_CONTAINER_STATIC_LINK -DBOOST_IOSTREAMS_NO_LIB -DBOOST_IOSTREAMS_STATIC_LINK -DBOOST_RANDOM_NO_LIB -DBOOST_RANDOM_STATIC_LINK -DCONFIG_PKGDATADIR="/usr/local/share/p4c" -DCONFIG_PREFIX="/usr/local" -DGC_USE_DLOPEN_WRAP -DMAX_LOGGING_LEVEL=10 -DP4C_GTEST_ENABLED -DSKIP_CPP_DEFINITIONS -D_GNU_SOURCE -Ip4c/build/control-plane -Ip4c -Ip4c/build -Ip4c/extensions -Ip4c/build/backends/p4tools/modules/flay/core/control_plane -Ip4c/build/backends/p4tools/common/control_plane -Ip4c/build/_deps/protobuf-src/src -Ip4c/build/_deps/bdwgc-src/include -isystem p4c/build/_deps/gtest-src/googlemock/include -isystem p4c/build/_deps/gtest-src/googletest/include -isystem p4c/build/_deps/z3-src/src/api -isystem p4c/build/_deps/z3-src/src/api/c++ -isystem p4c/build/_deps/abseil-src -isystem p4c/build/_deps/boost-src/libs/iostreams/include -isystem p4c/build/_deps/boost-src/libs/assert/include -isystem p4c/build/_deps/boost-src/libs/config/include -isystem p4c/build/_deps/boost-src/libs/core/include -isystem p4c/build/_deps/boost-src/libs/static_assert/include -isystem p4c/build/_deps/boost-src/libs/throw_exception/include -isystem p4c/build/_deps/boost-src/libs/detail/include -isystem p4c/build/_deps/boost-src/libs/preprocessor/include -isystem p4c/build/_deps/boost-src/libs/type_traits/include -isystem p4c/build/_deps/boost-src/libs/function/include -isystem p4c/build/_deps/boost-src/libs/bind/include -isystem p4c/build/_deps/boost-src/libs/integer/include -isystem p4c/build/_deps/boost-src/libs/iterator/include -isystem p4c/build/_deps/boost-src/libs/concept_check/include -isystem p4c/build/_deps/boost-src/libs/function_types/include -isystem p4c/build/_deps/boost-src/libs/mpl/include -isystem p4c/build/_deps/boost-src/libs/predef/include -isystem p4c/build/_deps/boost-src/libs/utility/include -isystem p4c/build/_deps/boost-src/libs/io/include -isystem p4c/build/_deps/boost-src/libs/fusion/include -isystem p4c/build/_deps/boost-src/libs/container_hash/include -isystem p4c/build/_deps/boost-src/libs/describe/include -isystem p4c/build/_deps/boost-src/libs/mp11/include -isystem p4c/build/_deps/boost-src/libs/tuple/include -isystem p4c/build/_deps/boost-src/libs/typeof/include -isystem p4c/build/_deps/boost-src/libs/functional/include -isystem p4c/build/_deps/boost-src/libs/optional/include -isystem p4c/build/_deps/boost-src/libs/move/include -isystem p4c/build/_deps/boost-src/libs/smart_ptr/include -isystem p4c/build/_deps/boost-src/libs/random/include -isystem p4c/build/_deps/boost-src/libs/array/include -isystem p4c/build/_deps/boost-src/libs/dynamic_bitset/include -isystem p4c/build/_deps/boost-src/libs/range/include -isystem p4c/build/_deps/boost-src/libs/conversion/include -isystem p4c/build/_deps/boost-src/libs/regex/include -isystem p4c/build/_deps/boost-src/libs/system/include -isystem p4c/build/_deps/boost-src/libs/variant2/include -isystem p4c/build/_deps/boost-src/libs/winapi/include -isystem p4c/build/_deps/boost-src/libs/format/include -isystem p4c/build/_deps/boost-src/libs/multiprecision/include -isystem p4c/build/_deps/boost-src/libs/lexical_cast/include -isystem p4c/build/_deps/boost-src/libs/container/include -isystem p4c/build/_deps/boost-src/libs/intrusive/include -isystem p4c/build/_deps/boost-src/libs/math/include -fdiagnostics-color=never -Wall -Wextra -Wno-overloaded-virtual -Wno-deprecated -Wno-deprecated-declarations -pedantic -Wno-gnu-zero-variadic-macro-arguments -O2 -g -DNDEBUG -fPIC -std=gnu++17 -o backends/p4tools/modules/flay/CMakeFiles/flay.dir/flay.cpp.o -c -resource-dir=/usr/lib/clang/20 -- p4c/backends/p4tools/modules/flay/flay.cpp
clangd:   Version: 18
HighCommander4 commented 1 month ago

Thanks, this is a much more useful backtrace! It indicates the crash occurs while clangd is running the boost-use-ranges clang-tidy check.

We've actually had another recent report of this in https://github.com/llvm/llvm-project/issues/109037. Please see the workaround in this comment.

HighCommander4 commented 1 month ago

Duplicate of https://github.com/llvm/llvm-project/issues/109037

fruffy commented 1 month ago

Great, thank you!