[Lldb-commits] [lldb] [lldb] Fix deadlock in parallel module loading with separate symbol thread pool (PR #160225)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 24 16:54:06 PDT 2025
GeorgeHuyubo wrote:
> Fixes a deadlock that occurs during parallel module loading when symbol indexing operations conflict with module list access. The deadlock happens when:
>
> * Thread A (symbol loading): holds Module.m_mutex → tries ModuleList.m_modules_mutex
> * Thread B (parallel module loading): holds ModuleList.m_modules_mutex → tries Module.m_mutex
@JDevlieghere @clayborg More context for the deadlock.
[bt.txt](https://github.com/user-attachments/files/22524471/bt.txt)
Thread 1:
Module::PreloadSymbols()->context switch-> ModuleList::GetSharedModule()
Thread 2:
ModuleList::GetSharedModule() -> Module::GetUUID()
So separating the thread pool will avoid thread 1 from context switching hence fixing this deadlock.
I am not sure how switching to read/write lock will fix this though?
Module::PreloadSymbols() – need write lock
ModuleList::GetSharedModule() – need write lock
Module::GetUUID() – need write lock(Unless we don’t do lazy initialization?)
https://github.com/llvm/llvm-project/pull/160225
More information about the lldb-commits
mailing list