llvm-project
60d447d0 - [lldb][windows] fix a race condition when polling Pipes (#172063)

Commit
16 days ago
[lldb][windows] fix a race condition when polling Pipes (#172063) This patch fixes a deadlock due to a race condition inside the `PipeEvent` class. The lldp-dap tests on Windows are very prone to this deadlock (from my testing almost 1/2 times `TestDAP_Launch.py` fails because of a deadlock inside `PipeEvent`. Before this patch, the destructor could try to set `m_ready` right before `PipeEvent::Monitor` would reset it, causing `WaitForSingleObject(m_ready, INFINITE);` to deadlock. This is fixed by ensuring all the `SetEvent` and `ResetEvent` calls inside the class are behind a mutex. Furthermore, `CancelIoEx` now passes the same `LPOVERLAPPED` reference as the one used by the blocking calls in `Monitor`. This ensure we only cancel the IO tasks which were created by `PipeEvent::Monitor`.
Parents
Loading