[Lldb-commits] [lldb] d8bd179 - Clear read_fd_set if EINTR received

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 23 04:27:28 PST 2023


Author: Emre Kultursay
Date: 2023-02-23T13:27:19+01:00
New Revision: d8bd179a173876a7a9ee11828b63efffe145356c

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

LOG: Clear read_fd_set if EINTR received

Leaving bits uncleared set causes callbacks to be triggered even
though there are no events to process. Starting with D131160
we have a callback that makes blocking read calls over pipe which
was causing the lldb-server main loop to become unresponsive / blocked
on Android.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D144240

Added: 
    

Modified: 
    lldb/source/Host/posix/MainLoopPosix.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/posix/MainLoopPosix.cpp b/lldb/source/Host/posix/MainLoopPosix.cpp
index b185c3d3b7076..5b50b450433ea 100644
--- a/lldb/source/Host/posix/MainLoopPosix.cpp
+++ b/lldb/source/Host/posix/MainLoopPosix.cpp
@@ -156,9 +156,12 @@ Status MainLoopPosix::RunImpl::Poll() {
     size_t sigset_len;
   } extra_data = {&kernel_sigset, sizeof(kernel_sigset)};
   if (syscall(__NR_pselect6, nfds, &read_fd_set, nullptr, nullptr, nullptr,
-              &extra_data) == -1 &&
-      errno != EINTR)
-    return Status(errno, eErrorTypePOSIX);
+              &extra_data) == -1) {
+    if (errno != EINTR)
+      return Status(errno, eErrorTypePOSIX);
+    else
+      FD_ZERO(&read_fd_set);
+  }
 
   return Status();
 }


        


More information about the lldb-commits mailing list