[Lldb-commits] [lldb] Fix single thread stepping timeout race condition (PR #104195)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 15 04:32:44 PDT 2024
https://github.com/labath approved this pull request.
This indeed fixes the race condition. I can confirm that the test no longer hangs after with this patch. I'm glad we were able to figure this out.
*However*, this doesn't appear to be the only problem here. With the hang out of the way, I can now see another failure mode, which appears with a lower (say ~0.1%) frequency.
Judging by the [logs](https://paste.debian.net/hidden/30235a5c/), the problem is triggered when the interrupt packet (^C) arrives too soon -- before the inferior has had a chance to execute anything. I haven't looked at the code, but my guess would be that the step-over thread plan erroneously decides that it's done (because it's back at the function it wanted to be in, but it does not realize that's because the PC hasn't been moved).
If you want to reproduce this yourself, I've found that inserting a 10ms sleep [here](https://github.com/llvm/llvm-project/blob/7898866065f6c9b72b5fa3e45e565baf8a5e7609/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp#L1005) makes the failure reproduce in about 50% of cases (as it increases the likelyhood that the interrupt will arrive "too soon" -- you could probably achieve the same thing by decreasing the single thread timeout)
https://github.com/llvm/llvm-project/pull/104195
More information about the lldb-commits
mailing list