[lldb-dev] [Bug 38443] New: "log enable dwarf all" introduces deadlocks

via lldb-dev lldb-dev at lists.llvm.org
Fri Aug 3 15:22:49 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38443

            Bug ID: 38443
           Summary: "log enable dwarf all" introduces deadlocks
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: mosescu at google.com
                CC: llvm-bugs at lists.llvm.org

Enabling dwarf logging introduces deadlocks: Module::m_mutex is aquired by
Module::GetDescription() for logging purposes. The problem is that most module
operations already hold this mutex (and the actual operation which requires
logging likely happens on a thread pool)

Here's a deadlock example:

Thread 1
-----------------------------------------------------------------------
libc.so.6!syscall (Unknown Source:0)
libstdc++.so.6!std::__atomic_futex_unsigned_base::_M_futex_wait_until(unsigned
int*, unsigned int, bool, std::chrono::duration<long, std::ratio<1l, 1l> >,
std::chrono::duration<long, std::ratio<1l, 1000000000l> >) (Unknown Source:0)
liblldb.so.7!std::__atomic_futex_unsigned<2147483648u>::_M_load_and_test_until(std::__atomic_futex_unsigned<2147483648>
* const this, unsigned int __assumed, unsigned int __operand, bool __equal,
std::memory_order __mo, bool __has_timeout, std::chrono::seconds __s,
std::chrono::nanoseconds __ns) (/usr/include/c++/7/bits/atomic_futex.h:102)
liblldb.so.7!std::__atomic_futex_unsigned<2147483648u>::_M_load_and_test(std::__atomic_futex_unsigned<2147483648>
* const this, unsigned int __assumed, unsigned int __operand, bool __equal,
std::memory_order __mo) (/usr/include/c++/7/bits/atomic_futex.h:122)
liblldb.so.7!_M_load_when_equal(std::memory_order __mo, unsigned int __val,
std::__atomic_futex_unsigned<2147483648> * const this)
(/usr/include/c++/7/bits/atomic_futex.h:162)
liblldb.so.7!std::__future_base::_State_baseV2::wait(std::__future_base::_State_baseV2
* const this) (/usr/include/c++/7/future:337)
liblldb.so.7!std::__basic_future<void>::wait(const std::__basic_future<void> *
const this) (/usr/include/c++/7/future:692)
liblldb.so.7!lldb_private::TaskMapOverInt(unsigned long, unsigned long,
llvm::function_ref<void (unsigned long)> const&)(size_t begin, size_t end,
const llvm::function_ref<void(long unsigned int)> & func)
(~/llvm/src/tools/lldb/source/Host/common/TaskPool.cpp:115)
liblldb.so.7!lldb_private::ManualDWARFIndex::Index(lldb_private::ManualDWARFIndex
* const this)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:71)
liblldb.so.7!lldb_private::ManualDWARFIndex::Preload(lldb_private::ManualDWARFIndex
* const this)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h:25)
liblldb.so.7!SymbolFileDWARF::PreloadSymbols(SymbolFileDWARF * const this)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:1980)
liblldb.so.7!lldb_private::Module::PreloadSymbols(lldb_private::Module * const
this) (~/llvm/src/tools/lldb/source/Core/Module.cpp:1411)
liblldb.so.7!lldb_private::Target::GetSharedModule(lldb_private::Target * const
this, const lldb_private::ModuleSpec & module_spec, lldb_private::Status *
error_ptr) (~/llvm/src/tools/lldb/source/Target/Target.cpp:2018)
liblldb.so.7!lldb_private::minidump::ProcessMinidump::ReadModuleList(lldb_private::minidump::ProcessMinidump
* const this)
(~/llvm/src/tools/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:351)
liblldb.so.7!lldb_private::minidump::ProcessMinidump::DoLoadCore(lldb_private::minidump::ProcessMinidump
* const this)
(~/llvm/src/tools/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp:188)
liblldb.so.7!lldb_private::Process::LoadCore(lldb_private::Process * const
this) (~/llvm/src/tools/lldb/source/Target/Process.cpp:2833)
liblldb.so.7!CommandObjectTargetCreate::DoExecute(CommandObjectTargetCreate *
const this, lldb_private::Args & command, lldb_private::CommandReturnObject &
result) (~/llvm/src/tools/lldb/source/Commands/CommandObjectTarget.cpp:364)
liblldb.so.7!lldb_private::CommandObjectParsed::Execute(lldb_private::CommandObjectParsed
* const this, const char * args_string, lldb_private::CommandReturnObject &
result) (~/llvm/src/tools/lldb/source/Interpreter/CommandObject.cpp:978)
liblldb.so.7!lldb_private::CommandInterpreter::HandleCommand(lldb_private::CommandInterpreter
* const this, const char * command_line, lldb_private::LazyBool
lazy_add_to_history, lldb_private::CommandReturnObject & result,
lldb_private::ExecutionContext * override_context, bool
repeat_on_empty_command, bool no_context_switching)
(~/llvm/src/tools/lldb/source/Interpreter/CommandInterpreter.cpp:1695)
liblldb.so.7!lldb_private::CommandInterpreter::IOHandlerInputComplete(lldb_private::CommandInterpreter
* const this, lldb_private::IOHandler & io_handler, std::__cxx11::string &
line) (~/llvm/src/tools/lldb/source/Interpreter/CommandInterpreter.cpp:2696)

Thread 2
-----------------------------------------------------------------------
libpthread.so.0!__lll_lock_wait()
(/tmp/build-debs.Lfl5zt/glibc-2.24/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135)
libpthread.so.0!__GI___pthread_mutex_lock(pthread_mutex_t * mutex)
(/tmp/build-debs.Lfl5zt/glibc-2.24/nptl/pthread_mutex_lock.c:115)
liblldb.so.7!__gthread_mutex_lock(__gthread_mutex_t * __mutex)
(/usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:748)
liblldb.so.7!__gthread_recursive_mutex_lock(__gthread_recursive_mutex_t *
__mutex) (/usr/include/x86_64-linux-gnu/c++/7/bits/gthr-default.h:810)
liblldb.so.7!std::recursive_mutex::lock(std::recursive_mutex * const this)
(/usr/include/c++/7/mutex:107)
liblldb.so.7!std::lock_guard<std::recursive_mutex>::lock_guard(std::lock_guard<std::recursive_mutex>
* const this, std::lock_guard<std::recursive_mutex>::mutex_type & __m)
(/usr/include/c++/7/bits/std_mutex.h:162)
liblldb.so.7!lldb_private::Module::GetDescription(lldb_private::Module * const
this, lldb_private::Stream * s, lldb::DescriptionLevel level)
(~/llvm/src/tools/lldb/source/Core/Module.cpp:1082)
liblldb.so.7!lldb_private::Module::LogMessageVerboseBacktrace(lldb_private::Module
* const this, lldb_private::Log * log, const char * format)
(~/llvm/src/tools/lldb/source/Core/Module.cpp:1199)
liblldb.so.7!DWARFUnit::ExtractDIEsRWLocked(DWARFUnit * const this)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:174)
liblldb.so.7!DWARFUnit::ExtractDIEsScoped(DWARFUnit * const this)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:116)
liblldb.so.7!lldb_private::ManualDWARFIndex::<lambda(size_t)>::operator()(size_t)
const(const lldb_private::ManualDWARFIndex::<lambda(size_t)> * const __closure,
size_t cu_idx)
(~/llvm/src/tools/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp:58)
liblldb.so.7!llvm::function_ref<void(long unsigned
int)>::callback_fn<lldb_private::ManualDWARFIndex::Index()::<lambda(size_t)>
>(intptr_t, unsigned long)(intptr_t callable,  params#0)
(~/llvm/src/include/llvm/ADT/STLExtras.h:115)
liblldb.so.7!llvm::function_ref<void (unsigned long)>::operator()(unsigned
long) const(const llvm::function_ref<void(long unsigned int)> * const this, 
params#0) (~/llvm/src/include/llvm/ADT/STLExtras.h:132)
liblldb.so.7!lldb_private::<lambda()>::operator()(void) const(const
lldb_private::<lambda()> * const __closure)
(~/llvm/src/tools/lldb/source/Host/common/TaskPool.cpp:106)
liblldb.so.7!std::__invoke_impl<void, lldb_private::TaskMapOverInt(size_t,
size_t, const llvm::function_ref<void(long unsigned
int)>&)::<lambda()>&>(std::__invoke_other, lldb_private::<lambda()>
&)(lldb_private::<lambda()> & __f) (/usr/include/c++/7/bits/invoke.h:60)
liblldb.so.7!std::__invoke<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned
int)>&)::<lambda()>&>(lldb_private::<lambda()> &)(lldb_private::<lambda()> &
__fn) (/usr/include/c++/7/bits/invoke.h:95)
liblldb.so.7!std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned
int)>&)::<lambda()>()>::__call<void>(<unknown type in
~/llvm/build-debug/bin/../lib/liblldb.so.7, CU 0x286b7276, DIE 0x286d2246>,
std::_Index_tuple<>)(std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t,
const llvm::function_ref<void(long unsigned int)>&)::<lambda()>()> * const
this, <unknown type in ~/llvm/build-debug/bin/../lib/liblldb.so.7, CU
0x286b7276, DIE 0x286d2246> __args) (/usr/include/c++/7/functional:467)
liblldb.so.7!std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned
int)>&)::<lambda()>()>::operator()<>(void)(std::_Bind<lldb_private::TaskMapOverInt(size_t,
size_t, const llvm::function_ref<void(long unsigned int)>&)::<lambda()>()> *
const this) (/usr/include/c++/7/functional:551)
liblldb.so.7!std::__invoke_impl<void,
std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned
int)>&)::<lambda()>()>&>(std::__invoke_other,
std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned int)>&)::<lambda()>()>
&)(std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned int)>&)::<lambda()>()> & __f)
(/usr/include/c++/7/bits/invoke.h:60)
liblldb.so.7!std::__invoke<std::_Bind<lldb_private::TaskMapOverInt(size_t,
size_t, const llvm::function_ref<void(long unsigned
int)>&)::<lambda()>()>&>(std::_Bind<lldb_private::TaskMapOverInt(size_t,
size_t, const llvm::function_ref<void(long unsigned int)>&)::<lambda()>()>
&)(std::_Bind<lldb_private::TaskMapOverInt(size_t, size_t, const
llvm::function_ref<void(long unsigned int)>&)::<lambda()>()> & __fn)
(/usr/include/c++/7/bits/invoke.h:95)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20180803/333f4748/attachment.html>


More information about the lldb-dev mailing list