diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-04-15 17:46:28 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2013-04-15 17:46:28 -0400 |
commit | 7182203ebf4ba914c3a49f9593b1ed831fa6c1e9 (patch) | |
tree | f87bd7ffa338e42d0b9a9f3d4bf5432c9b57c191 | |
parent | 5976dc144e774ae363cbf774337ccf663015cc6d (diff) |
SH-4061 WIP - moved all retry logic into lltexturefetch, some cleanup. Debug setting now defines a fake failure rate.
-rwxr-xr-x[-rw-r--r--] | indra/newview/app_settings/logcontrol.xml | 0 | ||||
-rwxr-xr-x | indra/newview/app_settings/settings.xml | 6 | ||||
-rwxr-xr-x | indra/newview/lltexturefetch.cpp | 37 | ||||
-rwxr-xr-x | indra/newview/lltexturefetch.h | 2 | ||||
-rwxr-xr-x | indra/newview/llviewertexture.cpp | 45 | ||||
-rwxr-xr-x | indra/newview/llviewertexture.h | 1 |
6 files changed, 33 insertions, 58 deletions
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 92a241857e..92a241857e 100644..100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0b7f99ebc1..18a33b3542 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -11130,16 +11130,16 @@ <key>Value</key> <integer>0</integer> </map> - <key>TextureFetchFakeFailures</key> + <key>TextureFetchFakeFailureRate</key> <map> <key>Comment</key> <string>Simulate HTTP fetch failures for some server bake textures.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> - <string>Boolean</string> + <string>F32</string> <key>Value</key> - <integer>0</integer> + <integer>0.0</integer> </map> <key>TextureFetchSource</key> <map> diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 8e78638c0a..2cebd4b6eb 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -410,13 +410,11 @@ public: // Inherited from LLCore::HttpHandler // Threads: Ttf virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response); - - void setFakeFailure(bool fake_failure) { mFakeFailure = fake_failure; } protected: LLTextureFetchWorker(LLTextureFetch* fetcher, FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, - F32 priority, S32 discard, S32 size, bool fake_failure); + F32 priority, S32 discard, S32 size); private: @@ -572,7 +570,6 @@ private: S32 mActiveCount; LLCore::HttpStatus mGetStatus; std::string mGetReason; - bool mFakeFailure; LLAdaptiveRetryPolicy mFetchRetryPolicy; @@ -864,8 +861,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, const LLHost& host, // Simulator host F32 priority, // Priority S32 discard, // Desired discard - S32 size, // Desired size - bool fake_failure) // For testing, simulate http failure if true. + S32 size) // Desired size : LLWorkerClass(fetcher, "TextureFetch"), LLCore::HttpHandler(), mState(INIT), @@ -919,7 +915,6 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mCacheReadCount(0U), mCacheWriteCount(0U), mResourceWaitCount(0U), - mFakeFailure(fake_failure), mFetchRetryPolicy(15.0,15.0,1.0,10) { mCanUseNET = mUrl.empty() ; @@ -1179,6 +1174,7 @@ bool LLTextureFetchWorker::doWork(S32 param) mDesiredSize = llmax(mDesiredSize, TEXTURE_CACHE_ENTRY_SIZE); // min desired size is TEXTURE_CACHE_ENTRY_SIZE LL_DEBUGS("Texture") << mID << ": Priority: " << llformat("%8.0f",mImagePriority) << " Desired Discard: " << mDesiredDiscard << " Desired Size: " << mDesiredSize << LL_ENDL; + // fall through } @@ -1315,6 +1311,7 @@ bool LLTextureFetchWorker::doWork(S32 param) return false; } } + static LLCachedControl<bool> use_http(gSavedSettings,"ImagePipelineUseHTTP"); // if (mHost != LLHost::invalid) get_url = false; @@ -1965,11 +1962,14 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); } - if (mFakeFailure) + static LLCachedControl<F32> fake_failure_rate(gSavedSettings, "TextureFetchFakeFailureRate"); + F32 rand_val = ll_frand(); + F32 rate = fake_failure_rate; + if (mFTType == FTT_SERVER_BAKE && (fake_failure_rate > 0.0) && (rand_val < fake_failure_rate)) { - llwarns << mID << " for debugging, setting fake failure status for texture " << mID << llendl; - response->setStatus(LLCore::HttpStatus(500)); - setFakeFailure(false); + llwarns << mID << " for debugging, setting fake failure status for texture " << mID + << " (rand was " << rand_val << "/" << rate << ")" << llendl; + response->setStatus(LLCore::HttpStatus(503)); } bool success = true; bool partial = false; @@ -1981,12 +1981,12 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe F32 retry_after; if (mFetchRetryPolicy.shouldRetry(retry_after)) { - llinfos << mID << " should retry after " << retry_after << ", resetting state to INIT" << llendl; + llinfos << mID << " should retry after " << retry_after << ", resetting state to LOAD_FROM_NETWORK" << llendl; mFetcher->removeFromHTTPQueue(mID, 0); std::string reason(status.toString()); setGetStatus(status, reason); releaseHttpSemaphore(); - setState(INIT); + setState(LOAD_FROM_NETWORK); return; } else @@ -2559,7 +2559,7 @@ LLTextureFetch::~LLTextureFetch() } bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http, bool fake_failure) + S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http) { if(mFetcherLocked) { @@ -2633,7 +2633,6 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->setDesiredDiscard(desired_discard, desired_size); worker->setCanUseHTTP(can_use_http); worker->setUrl(url); - worker->setFakeFailure(fake_failure); if (!worker->haveWork()) { worker->setState(LLTextureFetchWorker::INIT); @@ -2648,7 +2647,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const } else { - worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size, fake_failure); + worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size); lockQueue(); // +Mfq mRequestMap[id] = worker; unlockQueue(); // -Mfq @@ -3333,7 +3332,11 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) void LLTextureFetchWorker::setState(e_state new_state) { - LL_DEBUGS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; + if (mFTType == FTT_SERVER_BAKE) + { +// LL_INFOS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; + } +// LL_DEBUGS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; mState = new_state; } diff --git a/indra/newview/lltexturefetch.h b/indra/newview/lltexturefetch.h index 12226d51c8..5e2b55dbbb 100755 --- a/indra/newview/lltexturefetch.h +++ b/indra/newview/lltexturefetch.h @@ -78,7 +78,7 @@ public: // Threads: T* (but Tmain mostly) bool createRequest(FTType f_type, const std::string& url, const LLUUID& id, const LLHost& host, F32 priority, - S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http, bool fake_failure); + S32 w, S32 h, S32 c, S32 discard, bool needs_aux, bool can_use_http); // Requests that a fetch operation be deleted from the queue. // If @cancel is true, also stops any I/O operations pending. diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 8f7c8e40b7..45b402f0f6 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -962,8 +962,6 @@ void LLViewerFetchedTexture::init(bool firstinit) // does not contain this image. mIsMissingAsset = FALSE; - mFetchFailureCount = 0; - mLoadedCallbackDesiredDiscardLevel = S8_MAX; mPauseLoadedCallBacks = FALSE ; @@ -1826,35 +1824,17 @@ bool LLViewerFetchedTexture::updateFetch() // We finished but received no data if (current_discard < 0) { - const S32 MAX_FETCH_FAILURE = 1; - mFetchFailureCount++; if (getFTType() != FTT_MAP_TILE) { - llwarns << "Fetch failure for " << mID << " failure count " << mFetchFailureCount - << " status " << mLastHttpGetStatus.toHex() << llendl; - } - // Will retry server-bake textures under a limited set of circumstances. - if (getFTType() == FTT_SERVER_BAKE && - mLastHttpGetStatus.isHttpStatus() && - mLastHttpGetStatus.mType >= 500 && - mLastHttpGetStatus.mType <= 599 && // Only retry 5xx failures. - mFetchFailureCount < MAX_FETCH_FAILURE) - { - llwarns << "Will retry fetch" << llendl; - } - else // Otherwise, assume the image is missing. - { - if (getFTType() != FTT_MAP_TILE) - { - llwarns << "!mIsFetching, setting as missing, decode_priority " << decode_priority - << " mRawDiscardLevel " << mRawDiscardLevel - << " current_discard " << current_discard - << " stats " << mLastHttpGetStatus.toHex() - << llendl; - } - setIsMissingAsset(); - desired_discard = -1; + llwarns << mID + << " Fetch failure, setting as missing, decode_priority " << decode_priority + << " mRawDiscardLevel " << mRawDiscardLevel + << " current_discard " << current_discard + << " stats " << mLastHttpGetStatus.toHex() + << llendl; } + setIsMissingAsset(); + desired_discard = -1; } else { @@ -1968,14 +1948,8 @@ bool LLViewerFetchedTexture::updateFetch() // bypass texturefetch directly by pulling from LLTextureCache bool fetch_request_created = false; - bool fake_failure = false; - const bool debug_setting_fake_failures = gSavedSettings.getBOOL("TextureFetchFakeFailures"); - if (getFTType() == FTT_SERVER_BAKE && mFetchFailureCount == 0 && debug_setting_fake_failures) - { - fake_failure = true; - } fetch_request_created = LLAppViewer::getTextureFetch()->createRequest(mFTType, mUrl, getID(), getTargetHost(), decode_priority, - w, h, c, desired_discard, needsAux(), mCanUseHTTP, fake_failure); + w, h, c, desired_discard, needsAux(), mCanUseHTTP); if (fetch_request_created) { @@ -2072,7 +2046,6 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing) else { llinfos << mID << ": un-flagging missing asset" << llendl; - mFetchFailureCount = 0; } mIsMissingAsset = is_missing; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 91e903ffd6..bf6aadd218 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -452,7 +452,6 @@ protected: FTType mFTType; // What category of image is this - map tile, server bake, etc? mutable BOOL mIsMissingAsset; // True if we know that there is no image asset with this image id in the database. - S32 mFetchFailureCount; // How many times has a fetch failed in a way that suggests the asset is missing? typedef std::list<LLLoadedCallbackEntry*> callback_list_t; S8 mLoadedCallbackDesiredDiscardLevel; |