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

Crash: clangd while indexing #98428

Closed
bluecorvetteai opened this issue Jul 11, 2024 · 9 comments
Closed

Crash: clangd while indexing #98428

bluecorvetteai opened this issue Jul 11, 2024 · 9 comments
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@bluecorvetteai
Copy link

Occured while indexing a project. To make sure I stay in the bounds of my company's IP, I've obsured the names of our files and directory structure.

If that information is needed, let me know, also if there is anything else I can provide.

clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b748)
Features: linux+grpc
Platform: x86_64-unknown-linux-gnu

Thank you,
Kevin

[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\nStack dump:\n0.\t parser at end of file\n1.\t/home/kevin/r...: instantiating function definition 'abc::TimeIndexed<std::unique_ptr<abc_sss::ss::RawData_<std::allocator>>, abc::StampedSmokeSignalTemporalDeref<abc_sss::ss::RawData_<std::allocator>>>::PopUntilInclusive'\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.892] Built preamble of size 0 for file /home/kevin/.... version 0 in 7.07 seconds\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.893] Indexing c++17 standard library in the context of /home/kevin/....\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.893] --> workspace/semanticTokens/refresh(1)\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" 'V[21:44:02.893] >>> {\n "id": 1,\n "jsonrpc": "2.0",\n "method": "workspace/semanticTokens/refresh",\n "params": null\n}\n\n'
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" 'V[21:44:02.895] <<< {\n "id": 1,\n "jsonrpc": "2.0",\n "result": null\n}\n\nI[21:44:02.895] <-- reply(1)\nI[21:44:02.898] BeginSourceFile() failed when building AST for /home/kevin/....nI[21:44:02.899] --> textDocument/publishDiagnostics\nV[21:44:02.899] >>> {\n "jsonrpc": "2.0",\n "method": "textDocument/publishDiagnostics",\n "params": {\n "diagnostics": [],\n "uri": "file:///home/kevin/....",\n "version": 0\n }\n}\n\n'

[ERROR][2024-07-10 21:44:03] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" " #0 0x00000000004f680b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13\n #1 0x00000000004f464e llvm::sys::RunSignalHandlers() /__w/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:106:18\n #2 0x00000000004f7196 SignalHandler(int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1\n #3 0x00007fe86c94f520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #4 0x0000000000be0c9f checkDeducedTemplateArguments(clang::ASTContext&, clang::DeducedTemplateArgument const&, clang::DeducedTemplateArgument const&, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:237:3\n #5 0x0000000000bd4eb7 isNull /__w/clangd/clangd/llvm-project/clang/include/clang/AST/TemplateBase.h:298:42\n #6 0x0000000000bd4eb7 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1566:16\n #7 0x0000000000be003b DeduceTemplateArguments(clang::Sema&, clang::TemplateParameterList*, clang::TemplateArgument const&, clang::TemplateArgument, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2269:14\n #8 0x0000000000bdfe10 DeduceTemplateArguments(clang::Sema&, clang::TemplateParameterList*, llvm::ArrayRefclang::TemplateArgument, llvm::ArrayRefclang::TemplateArgument, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2443:16\n #9 0x0000000000be2bbf DeduceTemplateSpecArguments(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:0:0\n#10 0x0000000000bd6547 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1883:18\n#11 0x0000000000bd68ff DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:0:0\n#12 0x0000000000bd9231 DeduceTemplateArgumentsFromCallArgument(clang::Sema&, clang::TemplateParameterList*, unsigned int, clang::QualType, clang::QualType, clang::Expr::Classification, clang::Expr*, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImplclang::DeducedTemplateArgument&, llvm::SmallVectorImplclang::Sema::OriginalCallArg&, bool, unsigned int, unsigned int, clang::TemplateSpecCandidateSet*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4179:10\n#13 0x0000000000bd2ffa clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRefclang::Expr*, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRefclang::QualType)>)::$_3::operator()(clang::QualType, unsigned int, bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4297:3\n#14 0x0000000000bd283b clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRefclang::Expr*, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRefclang::QualType)>) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4322:16\n#15 0x0000000000ae8992 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRefclang::Expr*, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaOverload.cpp:7629:31\n#16 0x0000000001127834 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRefclang::Expr*)::$_4::operator()(clang::FunctionTemplateDecl*, clang::CXXDeductionGuideDecl*, clang::DeclAccessPair, bool, bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10714:7\n#17 0x0000000001118701 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRefclang::Expr*)::$_5::operator()(bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10811:7\n#18 0x0000000001117e75 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRefclang::Expr*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10884:3\n#19 0x000000000106934c clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRefclang::Expr*, clang::SourceLocation, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaExprCXX.cpp:1523:8\n#20 0x0000000000c3e252 RebuildCXXUnresolvedConstructExpr /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:3517:22\n#21 0x0000000000c3e252 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXUnresolvedConstructExpr(clang::CXXUnresolvedConstructExpr*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:13818:23\n#22 0x0000000000c507d5 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#23 0x0000000000c507d5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7957:14\n#24 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#25 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#26 0x0000000000c5313c isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#27 0x0000000000c5313c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7746:14\n#28 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#29 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#30 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#31 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#32 0x0000000000c31573 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:4098:23\n#33 0x0000000000c738b8 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5185:14\n#34 0x0000000000c76263 isDefined /__w/clangd/clangd/llvm-project/clang/include/clang/AST/Decl.h:2222:12\n#35 0x0000000000c76263 clang::Sema::PerformPendingInstantiations(bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6446:23\n#36 0x0000000000d2aaf7 ~TimeTraceScope /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:155:9\n#37 0x0000000000d2aaf7 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) /__w/clangd/clangd/llvm-project/clang/lib/Sema/Sema.cpp:1089:3\n#38 0x0000000000d2b1bb clang::Sema::ActOnEndOfTranslationUnit() /__w/clangd/clangd/llvm-project/clang/lib/Sema/Sema.cpp:1130:9\n#39 0x0000000002299efd clang::Parser::ParseTopLevelDecl(clang::OpaquePtrclang::DeclGroupRef&, clang::Sema::ModuleImportState&) /__w/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:727:13\n#40 0x0000000002295cce clang::ParseAST(clang::Sema&, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Parse/ParseAST.cpp:162:5\n#41 0x0000000001ee8cab clang::FrontendAction::Execute() /__w/clangd/clangd/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1073:10\n#42 0x0000000001632900 operator bool /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/Error.h:240:21\n#43 0x0000000001632900 clang::clangd::BackgroundIndex::index(clang::tooling::CompileCommand) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:325:19\n#44 0x0000000001635be2 _M_data /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:176:28\n#45 0x0000000001635be2 _M_is_local /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:211:16\n#46 0x0000000001635be2 _M_dispose /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:220:7\n#47 0x0000000001635be2 ~basic_string /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:647:9\n#48 0x0000000001635be2 ~CompileCommand /__w/clangd/clangd/llvm-project/clang/include/clang/Tooling/CompilationDatabase.h:44:8\n#49 0x0000000001635be2 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:168:22\n#50 0x0000000001635be2 std::_Function_handler<void (), clang::clangd::BackgroundIndex::indexFileTask(std::__cxx11::basic_string<char, std::char_traits, std::allocator >)::$_3>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:316:2\n#51 0x000000000163945f clang::clangd::BackgroundQueue::work(std::function<void ()>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/BackgroundQueue.cpp:44:25\n#52 0x000000000163409a ~_Function_base /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:275:11\n#53 0x000000000163409a operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:114:27\n#54 0x000000000163409a void llvm::detail::UniqueFunctionBase::CallImpl<clang::clangd::BackgroundIndex::BackgroundIndex(clang::clangd::ThreadsafeFS const&, clang::clangd::GlobalCompilationDatabase const&, llvm::unique_function<clang::clangd::BackgroundIndexStorage* (llvm::StringRef)>, clang::clangd::BackgroundIndex::Options)::$_1>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:221:12\n#55 0x00000000016a22a1 operator= /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:48:5\n#56 0x00000000016a22a1 PunnedPointer /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:37:60\n#57 0x00000000016a22a1 PointerIntPair /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:86:13\n#58 0x00000000016a22a1 UniqueFunctionBase /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:341:3\n#59 0x00000000016a22a1 unique_function /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:370:3\n#60 0x00000000016a22a1 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:103:14\n#61 0x00000000016a22a1 operator()<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) "

[ERROR][2024-07-10 21:44:03] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "&> /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:43:11\n#62 0x00000000016a22a1 __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\n#63 0x00000000016a22a1 __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\n#64 0x00000000016a22a1 __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\n#65 0x00000000016a22a1 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\n#66 0x00000000016a22a1 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\n#67 0x00000000016a22a1 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\n#68 0x00007fe86c9a1ac3 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac3)\n#69 0x00007fe86ca32a04 __clone (/lib/x86_64-linux-gnu/libc.so.6+0x125a04)\n"

@EugeneZelenko EugeneZelenko added clangd crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Jul 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 11, 2024

@llvm/issue-subscribers-clangd

Author: None (bluecorvetteai)

Occured while indexing a project. To make sure I stay in the bounds of my company's IP, I've obsured the names of our files and directory structure.

If that information is needed, let me know, also if there is anything else I can provide.

clangd version 18.1.3 (https://github.com/llvm/llvm-project c13b748)
Features: linux+grpc
Platform: x86_64-unknown-linux-gnu

Thank you,
Kevin

[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.\nStack dump:\n0.\t<eof> parser at end of file\n1.\t/home/kevin/r...: instantiating function definition 'abc::TimeIndexed<std::unique_ptr<abc_sss::ss::RawData_<std::allocator<void>>>, abc::StampedSmokeSignalTemporalDeref<abc_sss::ss::RawData_<std::allocator<void>>>>::PopUntilInclusive'\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.892] Built preamble of size 0 for file /home/kevin/.... version 0 in 7.07 seconds\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.893] Indexing c++17 standard library in the context of /home/kevin/....\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "I[21:44:02.893] --> workspace/semanticTokens/refresh(1)\n"
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" 'V[21:44:02.893] >>> {\n "id": 1,\n "jsonrpc": "2.0",\n "method": "workspace/semanticTokens/refresh",\n "params": null\n}\n\n'
[ERROR][2024-07-10 21:44:02] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" 'V[21:44:02.895] <<< {\n "id": 1,\n "jsonrpc": "2.0",\n "result": null\n}\n\nI[21:44:02.895] <-- reply(1)\nI[21:44:02.898] BeginSourceFile() failed when building AST for /home/kevin/....nI[21:44:02.899] --> textDocument/publishDiagnostics\nV[21:44:02.899] >>> {\n "jsonrpc": "2.0",\n "method": "textDocument/publishDiagnostics",\n "params": {\n "diagnostics": [],\n "uri": "file:///home/kevin/....",\n "version": 0\n }\n}\n\n'

[ERROR][2024-07-10 21:44:03] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" " #0 0x00000000004f680b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13\n #1 0x00000000004f464e llvm::sys::RunSignalHandlers() /__w/clangd/clangd/llvm-project/llvm/lib/Support/Signals.cpp:106:18\n #2 0x00000000004f7196 SignalHandler(int) /__w/clangd/clangd/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1\n #3 0x00007fe86c94f520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)\n #4 0x0000000000be0c9f checkDeducedTemplateArguments(clang::ASTContext&, clang::DeducedTemplateArgument const&, clang::DeducedTemplateArgument const&, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:237:3\n #5 0x0000000000bd4eb7 isNull /__w/clangd/clangd/llvm-project/clang/include/clang/AST/TemplateBase.h:298:42\n #6 0x0000000000bd4eb7 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1566:16\n #7 0x0000000000be003b DeduceTemplateArguments(clang::Sema&, clang::TemplateParameterList*, clang::TemplateArgument const&, clang::TemplateArgument, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2269:14\n #8 0x0000000000bdfe10 DeduceTemplateArguments(clang::Sema&, clang::TemplateParameterList*, llvm::ArrayRef<clang::TemplateArgument>, llvm::ArrayRef<clang::TemplateArgument>, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:2443:16\n #9 0x0000000000be2bbf DeduceTemplateSpecArguments(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:0:0\n#10 0x0000000000bd6547 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1883:18\n#11 0x0000000000bd68ff DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:0:0\n#12 0x0000000000bd9231 DeduceTemplateArgumentsFromCallArgument(clang::Sema&, clang::TemplateParameterList*, unsigned int, clang::QualType, clang::QualType, clang::Expr::Classification, clang::Expr*, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, llvm::SmallVectorImpl<clang::Sema::OriginalCallArg>&, bool, unsigned int, unsigned int, clang::TemplateSpecCandidateSet*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4179:10\n#13 0x0000000000bd2ffa clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>)::$_3::operator()(clang::QualType, unsigned int, bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4297:3\n#14 0x0000000000bd283b clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool, bool, clang::QualType, clang::Expr::Classification, llvm::function_ref<bool (llvm::ArrayRef<clang::QualType>)>) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4322:16\n#15 0x0000000000ae8992 clang::Sema::AddTemplateOverloadCandidate(clang::FunctionTemplateDecl*, clang::DeclAccessPair, clang::TemplateArgumentListInfo*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, bool, bool, clang::CallExpr::ADLCallKind, clang::OverloadCandidateParamOrder, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaOverload.cpp:7629:31\n#16 0x0000000001127834 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::$_4::operator()(clang::FunctionTemplateDecl*, clang::CXXDeductionGuideDecl*, clang::DeclAccessPair, bool, bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10714:7\n#17 0x0000000001118701 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>)::$_5::operator()(bool) const /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10811:7\n#18 0x0000000001117e75 clang::Sema::DeduceTemplateSpecializationFromInitializer(clang::TypeSourceInfo*, clang::InitializedEntity const&, clang::InitializationKind const&, llvm::MutableArrayRef<clang::Expr*>) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaInit.cpp:10884:3\n#19 0x000000000106934c clang::Sema::BuildCXXTypeConstructExpr(clang::TypeSourceInfo*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaExprCXX.cpp:1523:8\n#20 0x0000000000c3e252 RebuildCXXUnresolvedConstructExpr /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:3517:22\n#21 0x0000000000c3e252 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCXXUnresolvedConstructExpr(clang::CXXUnresolvedConstructExpr*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:13818:23\n#22 0x0000000000c507d5 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#23 0x0000000000c507d5 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformReturnStmt(clang::ReturnStmt*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7957:14\n#24 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#25 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#26 0x0000000000c5313c isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#27 0x0000000000c5313c clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformIfStmt(clang::IfStmt*) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7746:14\n#28 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#29 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#30 0x0000000000c42921 isInvalid /__w/clangd/clangd/llvm-project/clang/include/clang/Sema/Ownership.h:199:41\n#31 0x0000000000c42921 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/TreeTransform.h:7547:16\n#32 0x0000000000c31573 clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiate.cpp:4098:23\n#33 0x0000000000c738b8 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5185:14\n#34 0x0000000000c76263 isDefined /__w/clangd/clangd/llvm-project/clang/include/clang/AST/Decl.h:2222:12\n#35 0x0000000000c76263 clang::Sema::PerformPendingInstantiations(bool) /__w/clangd/clangd/llvm-project/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:6446:23\n#36 0x0000000000d2aaf7 ~TimeTraceScope /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:155:9\n#37 0x0000000000d2aaf7 clang::Sema::ActOnEndOfTranslationUnitFragment(clang::Sema::TUFragmentKind) /__w/clangd/clangd/llvm-project/clang/lib/Sema/Sema.cpp:1089:3\n#38 0x0000000000d2b1bb clang::Sema::ActOnEndOfTranslationUnit() /__w/clangd/clangd/llvm-project/clang/lib/Sema/Sema.cpp:1130:9\n#39 0x0000000002299efd clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /__w/clangd/clangd/llvm-project/clang/lib/Parse/Parser.cpp:727:13\n#40 0x0000000002295cce clang::ParseAST(clang::Sema&, bool, bool) /__w/clangd/clangd/llvm-project/clang/lib/Parse/ParseAST.cpp:162:5\n#41 0x0000000001ee8cab clang::FrontendAction::Execute() /__w/clangd/clangd/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1073:10\n#42 0x0000000001632900 operator bool /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/Error.h:240:21\n#43 0x0000000001632900 clang::clangd::BackgroundIndex::index(clang::tooling::CompileCommand) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:325:19\n#44 0x0000000001635be2 _M_data /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:176:28\n#45 0x0000000001635be2 _M_is_local /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:211:16\n#46 0x0000000001635be2 _M_dispose /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:220:7\n#47 0x0000000001635be2 ~basic_string /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/basic_string.h:647:9\n#48 0x0000000001635be2 ~CompileCommand /__w/clangd/clangd/llvm-project/clang/include/clang/Tooling/CompilationDatabase.h:44:8\n#49 0x0000000001635be2 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:168:22\n#50 0x0000000001635be2 std::_Function_handler<void (), clang::clangd::BackgroundIndex::indexFileTask(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::$_3>::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:316:2\n#51 0x000000000163945f clang::clangd::BackgroundQueue::work(std::function<void ()>) /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/BackgroundQueue.cpp:44:25\n#52 0x000000000163409a ~_Function_base /usr/bin/../lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:275:11\n#53 0x000000000163409a operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/index/Background.cpp:114:27\n#54 0x000000000163409a void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::BackgroundIndex::BackgroundIndex(clang::clangd::ThreadsafeFS const&, clang::clangd::GlobalCompilationDatabase const&, llvm::unique_function<clang::clangd::BackgroundIndexStorage* (llvm::StringRef)>, clang::clangd::BackgroundIndex::Options)::$_1>(void*) /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:221:12\n#55 0x00000000016a22a1 operator= /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:48:5\n#56 0x00000000016a22a1 PunnedPointer /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:37:60\n#57 0x00000000016a22a1 PointerIntPair /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:86:13\n#58 0x00000000016a22a1 UniqueFunctionBase /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:341:3\n#59 0x00000000016a22a1 unique_function /__w/clangd/clangd/llvm-project/llvm/include/llvm/ADT/FunctionExtras.h:370:3\n#60 0x00000000016a22a1 operator() /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:103:14\n#61 0x00000000016a22a1 operator()<(lambda at /__w/clangd/clangd/llvm-project/clang-tools-extra/clangd/support/Threading.cpp:98:15) "

[ERROR][2024-07-10 21:44:03] .../vim/lsp/rpc.lua:770 "rpc" "/usr/bin/clangd" "stderr" "&> /__w/clangd/clangd/llvm-project/llvm/include/llvm/Support/thread.h:43:11\n#62 0x00000000016a22a1 __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\n#63 0x00000000016a22a1 __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\n#64 0x00000000016a22a1 __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\n#65 0x00000000016a22a1 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\n#66 0x00000000016a22a1 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\n#67 0x00000000016a22a1 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\n#68 0x00007fe86c9a1ac3 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac3)\n#69 0x00007fe86ca32a04 __clone (/lib/x86_64-linux-gnu/libc.so.6+0x125a04)\n"

@bluecorvetteai
Copy link
Author

bluecorvetteai commented Jul 11, 2024

Just been reading clangd docs about crashes. I'll give simplifying this a real go. It seems there are a number of places in our project where this occurs and the crashes appear to be similar in nature. At least that is the impression I get. Let me see if I can boil this down a bit.

UPDATE
So it reoccurs in a fairly complex template with template parameters that take yet another template class. Not sure a simpler example will be straight forward to create. But let me see what I can do.

@HighCommander4
Copy link
Collaborator

HighCommander4 commented Jul 11, 2024

This is a crash in the clang frontend; such issues are often not specific to clangd (but sometimes can be). Once you've identified the source file the clangd indexer is crashing on, it's worth checking whether compiling the source file with a clang version that matches clangd (and the compile flags from compile_commands.json) also crashes.

@HighCommander4
Copy link
Collaborator

I found a frontend bug report with a crash in the same function (checkDeducedTemplateArguments) which was fixed on trunk just yesterday: #94614

@HighCommander4
Copy link
Collaborator

HighCommander4 commented Jul 11, 2024

I found a frontend bug report with a crash in the same function (checkDeducedTemplateArguments) which was fixed on trunk just yesterday: #94614

(So, if you can get your hands on a trunk build -- for example, from https://apt.llvm.org/ when a newer build than the current 20240709 one appears there -- it's worth testing with that too.)

@bluecorvetteai
Copy link
Author

Thank you @HighCommander4, really appreciate this. I'll check it out.

@bluecorvetteai
Copy link
Author

I pulled the latest from main branch and built clang and clangd (clang-tools-extra). Since this was fixed and merged, it makes sense to close this.

@bluecorvetteai
Copy link
Author

Fixed in #94614

@EugeneZelenko
Copy link
Contributor

More precisely, fixed in #94740.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clangd crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

4 participants