Skip to content

Don't hold the Target's ModuleListLock over running LoadScriptingResourceInTarget #138216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lldb/source/Core/ModuleList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,14 @@ bool ModuleList::LoadScriptingResourcesInTarget(Target *target,
bool continue_on_error) {
if (!target)
return false;
std::lock_guard<std::recursive_mutex> guard(m_modules_mutex);
for (auto module : m_modules) {
m_modules_mutex.lock();
// Don't hold the module list mutex while loading the scripting resources,
// The initializer might do any amount of work, and having that happen while
// the module list is held is asking for A/B locking problems.
const ModuleList tmp_module_list(*this);
m_modules_mutex.unlock();

for (auto module : tmp_module_list.ModulesNoLocking()) {
if (module) {
Status error;
if (!module->LoadScriptingResourceInTarget(target, error,
Expand Down
Loading