Author: John Harrison Date: 2025-04-16T07:52:16-07:00 New Revision: 183cb45c1280b80a0022649d1db8a93544bb97b0
URL: https://github.com/llvm/llvm-project/commit/183cb45c1280b80a0022649d1db8a93544bb97b0 DIFF: https://github.com/llvm/llvm-project/commit/183cb45c1280b80a0022649d1db8a93544bb97b0.diff LOG: [lldb-dap] Fixing a race during disconnect. (#135872) While attempting to disconnect the DAP transport reader thread is setting `disconnecting` as soon as it sees a [disconnect request](https://microsoft.github.io/debug-adapter-protocol/specification#Requests_Disconnect). However, if it is processing another request when this disconnect arrives the `DAP::Loop` handler may exit the loop without replying to the disconnect request. There has been some instability on the CI jobs due to this race, for example https://lab.llvm.org/buildbot/#/builders/59/builds/16076 To address this, ensure we only return from `DAP::Loop` once we've emptied the queue. 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 b752e9cfaeb85..597fe3a1e323b 100644 --- a/lldb/tools/lldb-dap/DAP.cpp +++ b/lldb/tools/lldb-dap/DAP.cpp @@ -921,7 +921,7 @@ llvm::Error DAP::Loop() { StopEventHandlers(); }); - while (!disconnecting) { + while (!disconnecting || !m_queue.empty()) { std::unique_lock<std::mutex> lock(m_queue_mutex); m_queue_cv.wait(lock, [&] { return disconnecting || !m_queue.empty(); }); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits