daniilavdeev wrote:

@Michael137, thanks for providing the context. Actually, I am not sure about my 
solution.

> we shouldn't try tearing down the debugger unless all process have exited.

I was about to write more about my observations. In particular, the lack of 
synchronization does seem to be the source of the issue. The `tearDown()` 
function (`lldb/packages/Python/lldbsuite/test/lldbtest.py`) invokes 
`cleanupSubprocesses()`, `SBDebugger.Destroy()`, and immediately after that 
calls `GarbageCollectAllocatedModules()`. Thus, I suspect that 
`SBDebugger.Destroy()` or `cleanupSubprocesses()` may not have released the 
lock by the time `GarbageCollectAllocatedModules()` is called.

Given that, I tried to make `GarbageCollectAllocatedModules()` wait until the 
lock becomes available again, rather than giving up after a single attempt. 
This approach seems to fix the sporadic failures, at least, I haven’t been able 
to reproduce any of them. However, I’m not sure whether it is appropriate, from 
the python api perspective, to change the mandatory flag in such a 
straightforward way.

https://github.com/llvm/llvm-project/pull/176884
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to