[Lldb-commits] [lldb] [lldb] Add a callback version of TCPSocket::Accept (PR #106955)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 3 02:00:17 PDT 2024


labath wrote:

> BTW, I have figured out a side effect. MainLoopWindows uses events created by WSACreateEvent(). WSACreateEvent() creates the `manual-reset` event. But WSAResetEvent() is used only for m_trigger_event. All other events (READ, ACCEPT, CLOSE) are never reset. I have no idea how it worked before. But I got thousands of error messages using this patch with lldb-server after first connection:
> 
> ```
> AcceptSocket(): A non-blocking socket operation could not be completed immediately
> ```
> 
> I have added `WSAResetEvent(KV.second.event);` before `ProcessReadObject(KV.first);` in MainLoopWindows.cpp to fix it. It seems this issue must be fixed before or with this patch, otherwise it will break the Windows build.


Oops. Thanks for catching that. I think have a pretty good idea of how this worked before. For accepts, we were always creating a fresh MainLoop instance (and a WSAEvent to go along with it), so this wasn't an issue. And for reads, we probably were just spinning in a busy loop after the first read event.

I've created #107061 to fix that.

https://github.com/llvm/llvm-project/pull/106955


More information about the lldb-commits mailing list