From 24d4517458f46ad0cd7284a5f30c4d961d518aa8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 10 Feb 2021 01:10:36 +0200 Subject: SL-14807 Viewer crashes when creating an experience --- indra/llmessage/llcoproceduremanager.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'indra/llmessage/llcoproceduremanager.cpp') diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index a4fe3a2a8e..850d4da74f 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -138,7 +138,7 @@ LLCoprocedureManager::~LLCoprocedureManager() close(); } -LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std::string &poolName) +void LLCoprocedureManager::initializePool(const std::string &poolName) { // Attempt to look up a pool size in the configuration. If found use that std::string keyName = "PoolSize" + poolName; @@ -171,8 +171,6 @@ LLCoprocedureManager::poolPtr_t LLCoprocedureManager::initializePool(const std:: bool inserted = mPoolMap.emplace(poolName, pool).second; LL_ERRS_IF(!inserted, "CoprocedureManager") << "Unable to add pool named \"" << poolName << "\" to map. FATAL!" << LL_ENDL; - - return pool; } //------------------------------------------------------------------------- @@ -182,20 +180,28 @@ LLUUID LLCoprocedureManager::enqueueCoprocedure(const std::string &pool, const s // not exist, create it. poolMap_t::iterator it = mPoolMap.find(pool); - poolPtr_t targetPool = (it != mPoolMap.end()) ? it->second : initializePool(pool); + if (it == mPoolMap.end()) + { + // initializing pools in enqueueCoprocedure is not thread safe, + // at the moment pools need to be initialized manually + LL_ERRS() << "Uninitialized pool " << name << LL_ENDL; + } + poolPtr_t targetPool = it->second; return targetPool->enqueueCoprocedure(name, proc); } void LLCoprocedureManager::setPropertyMethods(SettingQuery_t queryfn, SettingUpdate_t updatefn) { // functions to discover and store the pool sizes + // Might be a better idea to make an initializePool(name, size) to init everything externally mPropertyQueryFn = queryfn; mPropertyDefineFn = updatefn; - // workaround until we get mutex into initializePool - initializePool("VAssetStorage"); initializePool("Upload"); + initializePool("AIS"); // it might be better to have some kind of on-demand initialization for AIS + // "ExpCache" pool gets initialized in LLExperienceCache + // asset storage pool gets initialized in LLViewerAssetStorage } //------------------------------------------------------------------------- -- cgit v1.2.3 From 4a3e32e732e5fce6ecc02c15ef8966363f5a8f76 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 11 Feb 2021 02:49:13 +0200 Subject: SL-14807 Adjusted unit test --- indra/llmessage/llcoproceduremanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmessage/llcoproceduremanager.cpp') diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index 850d4da74f..c50d2bfd41 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -184,7 +184,7 @@ LLUUID LLCoprocedureManager::enqueueCoprocedure(const std::string &pool, const s { // initializing pools in enqueueCoprocedure is not thread safe, // at the moment pools need to be initialized manually - LL_ERRS() << "Uninitialized pool " << name << LL_ENDL; + LL_ERRS() << "Uninitialized pool " << pool << LL_ENDL; } poolPtr_t targetPool = it->second; -- cgit v1.2.3 From f06ebd054bfbcf7e3b4c8deb097cbb5064b85366 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 14 Feb 2021 19:48:17 +0200 Subject: SL-14807 Missed a pool init in unused constructor, additional protections --- indra/llmessage/llcoproceduremanager.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'indra/llmessage/llcoproceduremanager.cpp') diff --git a/indra/llmessage/llcoproceduremanager.cpp b/indra/llmessage/llcoproceduremanager.cpp index c50d2bfd41..b94ec541e9 100644 --- a/indra/llmessage/llcoproceduremanager.cpp +++ b/indra/llmessage/llcoproceduremanager.cpp @@ -140,11 +140,22 @@ LLCoprocedureManager::~LLCoprocedureManager() void LLCoprocedureManager::initializePool(const std::string &poolName) { + poolMap_t::iterator it = mPoolMap.find(poolName); + + if (it != mPoolMap.end()) + { + // Pools are not supposed to be initialized twice + // Todo: ideally restrict init to STATE_FIRST + LL_ERRS() << "Pool is already present " << poolName << LL_ENDL; + return; + } + // Attempt to look up a pool size in the configuration. If found use that std::string keyName = "PoolSize" + poolName; int size = 0; LL_ERRS_IF(poolName.empty(), "CoprocedureManager") << "Poolname must not be empty" << LL_ENDL; + LL_INFOS("CoprocedureManager") << "Initializing pool " << poolName << LL_ENDL; if (mPropertyQueryFn) { -- cgit v1.2.3