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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to