From fff8ab23a82c4a0c644d7bf6b5d1ddcdb875b361 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 9 Feb 2021 17:33:19 +0200 Subject: [PATCH 1/6] SL-14675 Teleporting to a new region can load the wrong EEP environment layer --- indra/newview/llenvironment.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index f0614487c4..d828bbf59b 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -1756,8 +1756,11 @@ void LLEnvironment::recordEnvironment(S32 parcel_id, LLEnvironment::EnvironmentI } else { - setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion); mTrackAltitudes = envinfo->mAltitudes; + // update track selection based on new altitudes + mCurrentTrack = calculateSkyTrackForAltitude(gAgent.getPositionAgent().mV[VZ]); + + setEnvironment(ENV_REGION, envinfo->mDayCycle, envinfo->mDayLength, envinfo->mDayOffset, envinfo->mEnvVersion); } LL_DEBUGS("ENVIRONMENT") << "Altitudes set to {" << mTrackAltitudes[0] << ", "<< mTrackAltitudes[1] << ", " << mTrackAltitudes[2] << ", " << mTrackAltitudes[3] << LL_ENDL; From 199f82786e1a19af519afa4713d2cced44c640d8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 9 Feb 2021 19:02:22 +0200 Subject: [PATCH 2/6] SL-14675 Position changes shouldn't cause additional blends when environment isn't ready --- indra/newview/llenvironment.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp index d828bbf59b..b6f120e644 100644 --- a/indra/newview/llenvironment.cpp +++ b/indra/newview/llenvironment.cpp @@ -2380,6 +2380,15 @@ void LLEnvironment::onAgentPositionHasChanged(const LLVector3 &localpos) return; mCurrentTrack = trackno; + + LLViewerRegion* cur_region = gAgent.getRegion(); + if (!cur_region || !cur_region->capabilitiesReceived()) + { + // Environment not ready, environment will be updated later, don't cause 'blend' yet. + // But keep mCurrentTrack updated in case we won't get new altitudes for some reason + return; + } + for (S32 env = ENV_LOCAL; env < ENV_DEFAULT; ++env) { if (mEnvironments[env]) From 24d4517458f46ad0cd7284a5f30c4d961d518aa8 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 10 Feb 2021 01:10:36 +0200 Subject: [PATCH 3/6] SL-14807 Viewer crashes when creating an experience --- indra/llmessage/llcoproceduremanager.cpp | 18 ++++++++++++------ indra/llmessage/llcoproceduremanager.h | 4 ++-- indra/llmessage/llexperiencecache.cpp | 2 ++ indra/newview/llstartup.cpp | 3 --- indra/newview/llviewerassetstorage.cpp | 1 + 5 files changed, 17 insertions(+), 11 deletions(-) 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 } //------------------------------------------------------------------------- diff --git a/indra/llmessage/llcoproceduremanager.h b/indra/llmessage/llcoproceduremanager.h index 70204ba02b..d6973996a9 100644 --- a/indra/llmessage/llcoproceduremanager.h +++ b/indra/llmessage/llcoproceduremanager.h @@ -79,6 +79,8 @@ public: void close(); void close(const std::string &pool); + + void initializePool(const std::string &poolName); private: @@ -87,8 +89,6 @@ private: poolMap_t mPoolMap; - poolPtr_t initializePool(const std::string &poolName); - SettingQuery_t mPropertyQueryFn; SettingUpdate_t mPropertyDefineFn; }; diff --git a/indra/llmessage/llexperiencecache.cpp b/indra/llmessage/llexperiencecache.cpp index 64c01bd9eb..db22ad2ea3 100644 --- a/indra/llmessage/llexperiencecache.cpp +++ b/indra/llmessage/llexperiencecache.cpp @@ -108,6 +108,8 @@ void LLExperienceCache::initSingleton() cache_stream >> (*this); } + LLCoprocedureManager::instance().initializePool("ExpCache"); + LLCoros::instance().launch("LLExperienceCache::idleCoro", boost::bind(&LLExperienceCache::idleCoro, this)); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 17777c3ceb..e4a5687dc6 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1818,9 +1818,6 @@ bool idle_startup() display_startup(); - //all categories loaded. lets create "My Favorites" category - gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE,true); - // set up callbacks LL_INFOS() << "Registering Callbacks" << LL_ENDL; LLMessageSystem* msg = gMessageSystem; diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 54f80a2995..b345396c2f 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -128,6 +128,7 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager * mCountSucceeded(0), mTotalBytesFetched(0) { + LLCoprocedureManager::instance().initializePool(VIEWER_ASSET_STORAGE_CORO_POOL); } LLViewerAssetStorage::~LLViewerAssetStorage() From 661d59596723e519466e7a5ce3d9742bcc544211 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Wed, 10 Feb 2021 13:39:10 +0200 Subject: [PATCH 4/6] SL-13497 Fixed error in logic --- indra/llplugin/llpluginprocessparent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp index 7d18bae947..e5b4dec1bd 100644 --- a/indra/llplugin/llpluginprocessparent.cpp +++ b/indra/llplugin/llpluginprocessparent.cpp @@ -154,9 +154,9 @@ void LLPluginProcessParent::shutdown() { EState state = (*it).second->mState; if (state != STATE_CLEANUP - || state != STATE_EXITING - || state != STATE_DONE - || state != STATE_ERROR) + && state != STATE_EXITING + && state != STATE_DONE + && state != STATE_ERROR) { (*it).second->setState(STATE_GOODBYE); } From 4a3e32e732e5fce6ecc02c15ef8966363f5a8f76 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 11 Feb 2021 02:49:13 +0200 Subject: [PATCH 5/6] SL-14807 Adjusted unit test --- indra/llmessage/llcoproceduremanager.cpp | 2 +- indra/llmessage/tests/llcoproceduremanager_test.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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; diff --git a/indra/llmessage/tests/llcoproceduremanager_test.cpp b/indra/llmessage/tests/llcoproceduremanager_test.cpp index 9db13a37b5..6424117ef3 100644 --- a/indra/llmessage/tests/llcoproceduremanager_test.cpp +++ b/indra/llmessage/tests/llcoproceduremanager_test.cpp @@ -91,6 +91,7 @@ namespace tut { Sync sync; int foo = 0; + LLCoprocedureManager::instance().initializePool("PoolName"); LLUUID queueId = LLCoprocedureManager::instance().enqueueCoprocedure("PoolName", "ProcName", [&foo, &sync] (LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t & ptr, const LLUUID & id) { sync.bump(); From f06ebd054bfbcf7e3b4c8deb097cbb5064b85366 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sun, 14 Feb 2021 19:48:17 +0200 Subject: [PATCH 6/6] SL-14807 Missed a pool init in unused constructor, additional protections --- indra/llmessage/llcoproceduremanager.cpp | 11 +++++++++++ indra/newview/llviewerassetstorage.cpp | 1 + 2 files changed, 12 insertions(+) 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) { diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index b345396c2f..19f2456ae6 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -115,6 +115,7 @@ LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager * mCountSucceeded(0), mTotalBytesFetched(0) { + LLCoprocedureManager::instance().initializePool(VIEWER_ASSET_STORAGE_CORO_POOL); }