fjricci created this revision.
fjricci added reviewers: clayborg, zturner, tberghammer.
Herald added subscribers: JDevlieghere, aprantl.

When dwarf parse logging is enabled (ie `log enable dwarf info`),
deadlocks can occur during dwarf parsing:

Thread 1:
`SymbolVendor::FindFunctions` (acquires mutex for Module)
`SymbolFileDWARF::Index`
<spawn task pool for `ExtractDIEsIfNeeded`>

Task pool threads:
`ExtractDIEsIfNeeded`
`Module::LogMessageVerboseBacktrace`
`Module::GetDescription` (tries to acquire mutex for Module and deadlocks)

Since `GetDescription` is read-only, only touches fairly immutable data
(architecture and filename), and is only used for logging,
the most straightforward fix is to remove the lock guard from this
function.


https://reviews.llvm.org/D41909

Files:
  source/Core/Module.cpp


Index: source/Core/Module.cpp
===================================================================
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1077,8 +1077,6 @@
 }
 
 void Module::GetDescription(Stream *s, lldb::DescriptionLevel level) {
-  std::lock_guard<std::recursive_mutex> guard(m_mutex);
-
   if (level >= eDescriptionLevelFull) {
     if (m_arch.IsValid())
       s->Printf("(%s) ", m_arch.GetArchitectureName());


Index: source/Core/Module.cpp
===================================================================
--- source/Core/Module.cpp
+++ source/Core/Module.cpp
@@ -1077,8 +1077,6 @@
 }
 
 void Module::GetDescription(Stream *s, lldb::DescriptionLevel level) {
-  std::lock_guard<std::recursive_mutex> guard(m_mutex);
-
   if (level >= eDescriptionLevelFull) {
     if (m_arch.IsValid())
       s->Printf("(%s) ", m_arch.GetArchitectureName());
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to