[Lldb-commits] [lldb] 4683f6b - [lldb-dap] Fix data race on disconnecting (#200017)

via lldb-commits lldb-commits at lists.llvm.org
Thu May 28 04:09:35 PDT 2026


Author: Ebuka Ezike
Date: 2026-05-28T12:09:30+01:00
New Revision: 4683f6ba6152e26c22adeaa4daf46732492228e5

URL: https://github.com/llvm/llvm-project/commit/4683f6ba6152e26c22adeaa4daf46732492228e5
DIFF: https://github.com/llvm/llvm-project/commit/4683f6ba6152e26c22adeaa4daf46732492228e5.diff

LOG: [lldb-dap] Fix data race on disconnecting (#200017)

Guard m_disconnecting with the m_queue_mutex because the value can be
changed in multiple threads

Added: 
    

Modified: 
    lldb/tools/lldb-dap/DAP.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/DAP.cpp
index a1bf829b646a3..cb34c7b2fd1e8 100644
--- a/lldb/tools/lldb-dap/DAP.cpp
+++ b/lldb/tools/lldb-dap/DAP.cpp
@@ -959,8 +959,10 @@ void DAP::Received(const protocol::Event &event) {
 }
 
 void DAP::Received(const protocol::Request &request) {
-  if (request.command == "disconnect")
+  if (request.command == "disconnect") {
+    std::lock_guard<std::mutex> guard(m_queue_mutex);
     m_disconnecting = true;
+  }
 
   const std::optional<CancelArguments> cancel_args =
       getArgumentsIfRequest<CancelArguments>(request, "cancel");


        


More information about the lldb-commits mailing list