[Lldb-commits] [PATCH] D122975: parallelize calling of Module::PreloadSymbols()

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon May 9 02:23:30 PDT 2022


labath added a comment.

I'm afraid I had to revert this, as it was causing hangs in TestMultipleDebuggers.py.

I haven't fully debugged this, but what I think is happening is this:

- the test debug multiple (identical) inferiors in parallel
- as a result the thread pool gets hit with many preload-symbols tasks for the same set of modules. As these tasks are taking the respective module mutexes, they cannot all make progress and a large part of them gets stuck.
- those that to manage to make progress (take the module mutex) get to the dwarf indexing stage. while waiting for the indexing tasks to complete, they start to perform some other tasks
- if one of those tasks is another preload-symbols task the can get stuck acquiring the module mutex. However, they will still be holding the mutex for the module that they are indexing, preventing the other threads from making progress
- if this happens to multiple threads, they can form a loop in the module mutex waits, thereby hanging forever

I'm not entirely sure what would be the right way to fix this, but it seems that we either need to make sure the threads don't hold the mutexes while performing other tasks (not sure if that's possible), or rethink the do-tasks-while-you-wait idea.

It should be fairly easy to reproduce this by running TestMultipleDebuggers a couple of times, but if you run into problems doing that, I can provide you with some backtraces, logs, or something.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122975



More information about the lldb-commits mailing list