Skip to content

Commit

Permalink
Clear read_fd_set if EINTR received
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emrekultursay authored and labath committed Feb 23, 2023
1 parent 5278614 commit d8bd179
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lldb/source/Host/posix/MainLoopPosix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit d8bd179

Please sign in to comment.