diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-05-21 20:06:41 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2021-05-21 20:52:08 +0300 |
commit | 96cbe528030b16dfb0c17b9668fb441a2cbc22c4 (patch) | |
tree | e951393964f1fe5420d5018db17b6ae47aa70c22 /indra | |
parent | 1c2f58fdcda20f8f7d2cb6e8ebcf64df5a01ed09 (diff) |
SL-15272 Bugsplat crashes at condition wait()
Made sure all waits will be triggered, won't loop back and that in case of http queue it had some time to trigger
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcommon/llthread.cpp | 3 | ||||
-rw-r--r-- | indra/llcorehttp/_httpreplyqueue.cpp | 1 | ||||
-rw-r--r-- | indra/llcorehttp/_httpreplyqueue.h | 1 | ||||
-rw-r--r-- | indra/llcorehttp/_httprequestqueue.cpp | 12 | ||||
-rw-r--r-- | indra/llcorehttp/_httprequestqueue.h | 2 | ||||
-rw-r--r-- | indra/llcorehttp/_httpservice.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llcompilequeue.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lldelayedgestureerror.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llmeshrepository.cpp | 19 | ||||
-rw-r--r-- | indra/newview/lloutfitgallery.cpp | 2 | ||||
-rw-r--r-- | indra/newview/lltoolmgr.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerassetstorage.cpp | 2 | ||||
-rw-r--r-- | indra/win_crash_logger/llcrashloggerwindows.cpp | 2 |
14 files changed, 36 insertions, 26 deletions
diff --git a/indra/llcommon/llthread.cpp b/indra/llcommon/llthread.cpp index 0b9dec969c..e9e6b5e73c 100644 --- a/indra/llcommon/llthread.cpp +++ b/indra/llcommon/llthread.cpp @@ -354,8 +354,9 @@ void LLThread::setQuitting() { mStatus = QUITTING; } + // It's only safe to remove mRunCondition if all locked threads were notified + mRunCondition->broadcast(); mDataLock->unlock(); - wake(); } // static diff --git a/indra/llcorehttp/_httpreplyqueue.cpp b/indra/llcorehttp/_httpreplyqueue.cpp index 2b138f3ad5..229bfdbe07 100644 --- a/indra/llcorehttp/_httpreplyqueue.cpp +++ b/indra/llcorehttp/_httpreplyqueue.cpp @@ -56,7 +56,6 @@ void HttpReplyQueue::addOp(const HttpReplyQueue::opPtr_t &op) mQueue.push_back(op); } - mQueueCV.notify_all(); } diff --git a/indra/llcorehttp/_httpreplyqueue.h b/indra/llcorehttp/_httpreplyqueue.h index 928ee10a83..33e205c1c9 100644 --- a/indra/llcorehttp/_httpreplyqueue.h +++ b/indra/llcorehttp/_httpreplyqueue.h @@ -98,7 +98,6 @@ protected: OpContainer mQueue; LLCoreInt::HttpMutex mQueueMutex; - LLCoreInt::HttpConditionVariable mQueueCV; }; // end class HttpReplyQueue diff --git a/indra/llcorehttp/_httprequestqueue.cpp b/indra/llcorehttp/_httprequestqueue.cpp index c6f4ad789f..ad72bdcce6 100644 --- a/indra/llcorehttp/_httprequestqueue.cpp +++ b/indra/llcorehttp/_httprequestqueue.cpp @@ -142,13 +142,19 @@ void HttpRequestQueue::wakeAll() } -void HttpRequestQueue::stopQueue() +bool HttpRequestQueue::stopQueue() { { HttpScopedLock lock(mQueueMutex); - mQueueStopped = true; - wakeAll(); + if (!mQueueStopped) + { + mQueueStopped = true; + wakeAll(); + return true; + } + wakeAll(); + return false; } } diff --git a/indra/llcorehttp/_httprequestqueue.h b/indra/llcorehttp/_httprequestqueue.h index 3c3d134b07..f0296f30e3 100644 --- a/indra/llcorehttp/_httprequestqueue.h +++ b/indra/llcorehttp/_httprequestqueue.h @@ -124,7 +124,7 @@ public: /// them on their way. /// /// Threading: callable by any thread. - void stopQueue(); + bool stopQueue(); protected: static HttpRequestQueue * sInstance; diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 34268d94f6..56f52f1b09 100644 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -87,7 +87,11 @@ HttpService::~HttpService() // is a bit tricky. if (mRequestQueue) { - mRequestQueue->stopQueue(); + if (mRequestQueue->stopQueue()) + { + // Give mRequestQueue a chance to finish + ms_sleep(10); + } } if (mThread) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 268999bd2a..31b5cf9aaa 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3626,7 +3626,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd } llcoro::suspend(); - if (LLApp::isQuitting()) + if (LLApp::isExiting()) { return; } @@ -3693,7 +3693,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd LLSD result = httpAdapter->postAndSuspend(httpRequest, url, postData); - if (LLApp::isQuitting()) + if (LLApp::isExiting()) { return; } @@ -3733,7 +3733,7 @@ void LLAppearanceMgr::serverAppearanceUpdateCoro(LLCoreHttpUtil::HttpCoroutineAd LL_WARNS("Avatar") << "Bake retry #" << retryCount << " in " << timeout << " seconds." << LL_ENDL; llcoro::suspendUntilTimeout(timeout); - if (LLApp::isQuitting()) + if (LLApp::isExiting()) { return; } diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 3aaaaf52f5..bf10a9f2b4 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -347,7 +347,7 @@ void LLFloaterCompileQueue::processExperienceIdResults(LLSD result, LLUUID paren bool LLFloaterCompileQueue::processScript(LLHandle<LLFloaterCompileQueue> hfloater, const LLPointer<LLViewerObject> &object, LLInventoryObject* inventory, LLEventPump &pump) { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) { // Reply from coroutine came on shutdown // We are quiting, don't start any more coroutines! diff --git a/indra/newview/lldelayedgestureerror.cpp b/indra/newview/lldelayedgestureerror.cpp index ef1b644ad4..934a38bb8e 100644 --- a/indra/newview/lldelayedgestureerror.cpp +++ b/indra/newview/lldelayedgestureerror.cpp @@ -113,7 +113,7 @@ bool LLDelayedGestureError::doDialog(const LLErrorEntry &ent, bool uuid_ok) } } - if(!LLApp::isQuitting()) + if(!LLApp::isExiting()) { LLNotificationsUtil::add(ent.mNotifyName, args); } diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 3e8731dfe6..2c1c1191da 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -881,7 +881,7 @@ void LLMeshRepoThread::run() LL_WARNS(LOG_MESH) << "Convex decomposition unable to be loaded. Expect severe problems." << LL_ENDL; } - while (!LLApp::isQuitting()) + while (!LLApp::isExiting()) { // *TODO: Revise sleep/wake strategy and try to move away // from polling operations in this thread. We can sleep @@ -898,7 +898,7 @@ void LLMeshRepoThread::run() mSignal->wait(); - if (LLApp::isQuitting()) + if (LLApp::isExiting()) { break; } @@ -1168,7 +1168,7 @@ void LLMeshRepoThread::loadMeshPhysicsShape(const LLUUID& mesh_id) void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod) { - if (!LLAppViewer::isQuitting()) + if (!LLAppViewer::isExiting()) { loadMeshLOD(mesh_params, lod); } @@ -2654,7 +2654,7 @@ void LLMeshUploadThread::doWholeModelUpload() LL_DEBUGS(LOG_MESH) << "POST request issued." << LL_ENDL; mHttpRequest->update(0); - while (! LLApp::isQuitting() && ! finished() && ! isDiscarded()) + while (! LLApp::isExiting() && ! finished() && ! isDiscarded()) { ms_sleep(sleep_time); sleep_time = llmin(250U, sleep_time + sleep_time); @@ -2703,7 +2703,7 @@ void LLMeshUploadThread::requestWholeModelFee() U32 sleep_time(10); mHttpRequest->update(0); - while (! LLApp::isQuitting() && ! finished() && ! isDiscarded()) + while (! LLApp::isExiting() && ! finished() && ! isDiscarded()) { ms_sleep(sleep_time); sleep_time = llmin(250U, sleep_time + sleep_time); @@ -3149,7 +3149,7 @@ common_exit: LLMeshHeaderHandler::~LLMeshHeaderHandler() { - if (!LLApp::isQuitting()) + if (!LLApp::isExiting()) { if (! mProcessed) { @@ -3292,7 +3292,7 @@ void LLMeshHeaderHandler::processData(LLCore::BufferArray * /* body */, S32 /* b LLMeshLODHandler::~LLMeshLODHandler() { - if (! LLApp::isQuitting()) + if (! LLApp::isExiting()) { if (! mProcessed) { @@ -3553,7 +3553,7 @@ void LLMeshRepository::shutdown() mUploads[i]->discard() ; //discard the uploading requests. } - mThread->mSignal->signal(); + mThread->mSignal->broadcast(); while (!mThread->isStopped()) { @@ -4682,7 +4682,8 @@ void LLPhysicsDecomp::shutdown() if (mSignal) { mQuitting = true; - mSignal->signal(); + // There is only one wait(), but just in case 'broadcast' + mSignal->broadcast(); while (!isStopped()) { diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp index ca7bd8cb2c..593b27f839 100644 --- a/indra/newview/lloutfitgallery.cpp +++ b/indra/newview/lloutfitgallery.cpp @@ -1111,7 +1111,7 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id) } } - if (mGalleryCreated && !LLApp::isQuitting()) + if (mGalleryCreated && !LLApp::isExiting()) { reArrangeRows(); } diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 3fcf193dec..fa2dd60ee0 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -405,7 +405,7 @@ void LLToolMgr::clearTransientTool() void LLToolMgr::onAppFocusLost() { - if (LLApp::isQuitting()) + if (LLApp::isExiting()) return; if (mSelectedTool) diff --git a/indra/newview/llviewerassetstorage.cpp b/indra/newview/llviewerassetstorage.cpp index 7842d24279..9ac84b0635 100644 --- a/indra/newview/llviewerassetstorage.cpp +++ b/indra/newview/llviewerassetstorage.cpp @@ -544,7 +544,7 @@ void LLViewerAssetStorage::assetRequestCoro( LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts); - if (LLApp::isQuitting() || !gAssetStorage) + if (LLApp::isExiting() || !gAssetStorage) { // Bail out if result arrives after shutdown has been started. return; diff --git a/indra/win_crash_logger/llcrashloggerwindows.cpp b/indra/win_crash_logger/llcrashloggerwindows.cpp index 267224a79b..0cbe0b0d17 100644 --- a/indra/win_crash_logger/llcrashloggerwindows.cpp +++ b/indra/win_crash_logger/llcrashloggerwindows.cpp @@ -498,7 +498,7 @@ bool LLCrashLoggerWindows::frame() MSG msg; memset(&msg, 0, sizeof(msg)); - while (!LLApp::isQuitting() && GetMessage(&msg, NULL, 0, 0)) + while (!LLApp::isExiting() && GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); |