[Lldb-commits] [PATCH] D135516: [lldb] [MainLoopPosix] Fix crash upon adding lots of pending callbacks

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 10 00:34:37 PDT 2022


labath added a comment.

I never expected we would have so many callbacks that we'd have to worry about this, but yes, this is one way to fix the problem. Another (slightly simpler, but also less performant) would be to make the write pipe nonblocking, and do not treat EAGAIN as an error.



================
Comment at: lldb/source/Host/posix/MainLoopPosix.cpp:408
   assert(bytes_written == 1);
+  m_trigger_done = true;
 }
----------------
I /think/ this is not right. The other thread can wake up as soon as the Write call is done, and can proceed to clear the `done` flag before we are able to set it. If we set it afterwards, then we we suppress all subsequent writes, and the callbacks would never run. If we set the flag before we make the Write call, then it should be ok -- though the flag should probably have a different name then.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135516/new/

https://reviews.llvm.org/D135516



More information about the lldb-commits mailing list