[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 24 03:38:22 PDT 2025
labath wrote:
I think I understand most of what you're saying, and I think the proposed solution may solve the problem you have in mind -- but I don't think it can solve the problem *I* have in mind (and I'm not sure which of those is OP's problem :P). The race I *think* I see is in `Process::StopForDestroyOrDetach`.
We first check the process state (both of them), and if it's running, we install the hijack listener (and wait on it). However if the stopped event is sent (enqueued to the primary listener) before the hijack listener is installed, the listener will never get anything. I don't see how fiddling with thread identities can help there. Even if it does, it will only help for one particular thread. OP is calling Kill from the event handling thread, but I don't think we require that. If Kill is called from some other thread, I think it could still run into the same bug (although the race window will most likely be smaller, since the event thread will be alive and pulling events from the queue).
https://github.com/llvm/llvm-project/pull/144919
More information about the lldb-commits
mailing list