From 8bda5f20674df1765bce8f0866204dff93ed244c Mon Sep 17 00:00:00 2001 From: Sam McCall Date: Wed, 23 Oct 2019 11:11:18 +0200 Subject: [clangd] abort if shutdown takes more than a minute. Summary: A certain class of bug (e.g. infloop on an AST worker thread) currently means clangd never terminates, even if the editor shuts down the protocol and closes our stdin, and the main thread recognizes that. Instead, let's wait 60 seconds for threads to finish cleanly, and then crash if they haven't. (Obviously, we should still fix these bugs). Reviewers: kadircet Subscribers: MaskRay, jkorous, arphaman, jfb, usaxena95, cfe-commits, ilya-biryukov Tags: #clang Differential Revision: https://reviews.llvm.org/D69329 --- clang-tools-extra/clangd/ClangdLSPServer.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang-tools-extra/clangd/ClangdLSPServer.h') diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index dbd90064537..f1ed317f6ba 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -44,6 +44,7 @@ public: llvm::Optional CompileCommandsDir, bool UseDirBasedCDB, llvm::Optional ForcedOffsetEncoding, const ClangdServer::Options &Opts); + /// The destructor blocks on any outstanding background tasks. ~ClangdLSPServer(); /// Run LSP server loop, communicating with the Transport provided in the @@ -211,11 +212,10 @@ private: std::unique_ptr BaseCDB; // CDB is BaseCDB plus any comands overridden via LSP extensions. llvm::Optional CDB; - // The ClangdServer is created by the "initialize" LSP method. - // It is destroyed before run() returns, to ensure worker threads exit. ClangdServer::Options ClangdServerOpts; - llvm::Optional Server; llvm::Optional NegotiatedOffsetEncoding; + // The ClangdServer is created by the "initialize" LSP method. + llvm::Optional Server; }; } // namespace clangd } // namespace clang -- cgit v1.2.3