summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-11-23 00:57:46 +0200
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-11-23 17:57:19 +0200
commita1fed466f0cc0c08d3cdcba88e02230c94e763b0 (patch)
treeefa0d5d694ff271f49ea8e3b43a62362d42a5314
parent7dbe4540196dcae10d728f8a15f3fa7c9225a650 (diff)
SL-17434 Crash clearing LLEventPumps
We actively use event pumps's connections in threads, make sure nothing modifies list of connections during reset. And in case this doesn't fix the issue list affected pump before it crashes to have a better idea of what is going on.
-rw-r--r--indra/llcommon/llevents.cpp20
-rw-r--r--indra/llcommon/llevents.h5
-rw-r--r--indra/newview/llappviewer.cpp2
3 files changed, 22 insertions, 5 deletions
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp
index 0a213bddef..aa9a258723 100644
--- a/indra/llcommon/llevents.cpp
+++ b/indra/llcommon/llevents.cpp
@@ -152,12 +152,21 @@ void LLEventPumps::clear()
}
}
-void LLEventPumps::reset()
+void LLEventPumps::reset(bool log_pumps)
{
// Reset every known LLEventPump instance. Leave it up to each instance to
// decide what to do with the reset() call.
+ if (log_pumps)
+ {
+ LL_INFOS() << "Resetting " << (S32)mPumpMap.size() << " pumps" << LL_ENDL;
+ }
+
for (PumpMap::value_type& pair : mPumpMap)
{
+ if (log_pumps)
+ {
+ LL_INFOS() << "Resetting pump " << pair.first << LL_ENDL;
+ }
pair.second->reset();
}
}
@@ -314,9 +323,11 @@ std::string LLEventPump::inventName(const std::string& pfx)
void LLEventPump::clear()
{
+ LLMutexLock lock(&mConnectionListMutex);
// Destroy the original LLStandardSignal instance, replacing it with a
// whole new one.
mSignal = std::make_shared<LLStandardSignal>();
+
mConnections.clear();
}
@@ -324,6 +335,7 @@ void LLEventPump::reset()
{
// Resetting mSignal is supposed to disconnect everything on its own
// But due to crash on 'reset' added explicit cleanup to get more data
+ LLMutexLock lock(&mConnectionListMutex);
ConnectionMap::const_iterator iter = mConnections.begin();
ConnectionMap::const_iterator end = mConnections.end();
while (iter!=end)
@@ -348,6 +360,8 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
return LLBoundListener();
}
+ LLMutexLock lock(&mConnectionListMutex);
+
float nodePosition = 1.0;
// if the supplied name is empty we are not interested in the ordering mechanism
@@ -507,8 +521,9 @@ LLBoundListener LLEventPump::listen_impl(const std::string& name, const LLEventL
return bound;
}
-LLBoundListener LLEventPump::getListener(const std::string& name) const
+LLBoundListener LLEventPump::getListener(const std::string& name)
{
+ LLMutexLock lock(&mConnectionListMutex);
ConnectionMap::const_iterator found = mConnections.find(name);
if (found != mConnections.end())
{
@@ -520,6 +535,7 @@ LLBoundListener LLEventPump::getListener(const std::string& name) const
void LLEventPump::stopListening(const std::string& name)
{
+ LLMutexLock lock(&mConnectionListMutex);
ConnectionMap::iterator found = mConnections.find(name);
if (found != mConnections.end())
{
diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h
index ae6e5aabc9..b5c4e58c9c 100644
--- a/indra/llcommon/llevents.h
+++ b/indra/llcommon/llevents.h
@@ -293,7 +293,7 @@ public:
* Reset all known LLEventPump instances
* workaround for DEV-35406 crash on shutdown
*/
- void reset();
+ void reset(bool log_pumps = false);
private:
friend class LLEventPump;
@@ -519,7 +519,7 @@ public:
/// Get the LLBoundListener associated with the passed name (dummy
/// LLBoundListener if not found)
- virtual LLBoundListener getListener(const std::string& name) const;
+ virtual LLBoundListener getListener(const std::string& name);
/**
* Instantiate one of these to block an existing connection:
* @code
@@ -562,6 +562,7 @@ private:
LLHandle<LLEventPumps> mRegistry;
std::string mName;
+ LLMutex mConnectionListMutex;
protected:
virtual LLBoundListener listen_impl(const std::string& name, const LLEventListener&,
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 5763ebe721..af8bceb7d8 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1736,7 +1736,7 @@ bool LLAppViewer::cleanup()
LLNotifications::instance().clear();
// workaround for DEV-35406 crash on shutdown
- LLEventPumps::instance().reset();
+ LLEventPumps::instance().reset(true);
//dump scene loading monitor results
if (LLSceneMonitor::instanceExists())