From f945415210f0e18c2c6d941fda6b7d45cb0f06f1 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Wed, 13 Mar 2013 06:26:25 +0000 Subject: Large changes to the LLCurl::Responder API, as well as pulling in some changes to common libraries from the server codebase: * Additional error checking in http handlers. * Uniform log spam for http errors. * Switch to using constants for http heads and status codes. * Fixed bugs in incorrectly checking if parsing LLSD xml resulted in an error. * Reduced spam regarding LLSD parsing errors in the default completedRaw http handler. It should not longer be necessary to short-circuit completedRaw to avoid spam. * Ported over a few bug fixes from the server code. * Switch mode http status codes to use S32 instead of U32. * Ported LLSD::asStringRef from server code; avoids copying strings all over the place. * Ported server change to LLSD::asBinary; this always returns a reference now instead of copying the entire binary blob. * Ported server pretty notation format (and pretty binary format) to llsd serialization. * The new LLCurl::Responder API no longer has two error handlers to choose from. Overriding the following methods have been deprecated: ** error - use httpFailure ** errorWithContent - use httpFailure ** result - use httpSuccess ** completed - use httpCompleted ** completedHeader - no longer necessary; call getResponseHeaders() from a completion method to obtain these headers. * In order to 'catch' a completed http request, override one of these methods: ** httpSuccess - Called for any 2xx status code. ** httpFailure - Called for any non-2xx status code. ** httpComplete - Called for all status codes. Default implementation is to call either httpSuccess or httpFailure. * It is recommended to keep these methods protected/private in order to avoid triggering of these methods without using a 'push' method (see below). * Uniform error handling should followed whenever possible by calling a variant of this during httpFailure: ** llwarns << dumpResponse() << llendl; * Be sure to include LOG_CLASS(your_class_name) in your class in order for the log entry to give more context. * In order to 'push' a result into the responder, you should no longer call error, errorWithContent, result, or completed. * Nor should you directly call httpSuccess/Failure/Completed (unless passing a message up to a parent class). * Instead, you can set the internal content of a responder and trigger a corresponding method using the following methods: ** successResult - Sets results and calls httpSuccess ** failureResult - Sets results and calls httpFailure ** completedResult - Sets results and calls httpCompleted * To obtain information about a the response from a reponder method, use the following getters: ** getStatus - HTTP status code ** getReason - Reason string ** getContent - Content (Parsed body LLSD) ** getResponseHeaders - Response Headers (LLSD map) ** getHTTPMethod - HTTP method of the request ** getURL - URL of the request * It is still possible to override completeRaw if you want to manipulate data directly out of LLPumpIO. * See indra/llmessage/llcurl.h for more information. --- indra/newview/lltexturefetch.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 81bc70906d..d61a87c031 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -36,7 +36,7 @@ #include "lldir.h" #include "llhttpclient.h" -#include "llhttpstatuscodes.h" +#include "llhttpconstants.h" #include "llimage.h" #include "llimagej2c.h" #include "llimageworker.h" @@ -2350,9 +2350,10 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mHttpRequest = new LLCore::HttpRequest; mHttpOptions = new LLCore::HttpOptions; mHttpHeaders = new LLCore::HttpHeaders; - mHttpHeaders->mHeaders.push_back("Accept: image/x-j2c"); + // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? + mHttpHeaders->mHeaders.push_back(HTTP_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); mHttpMetricsHeaders = new LLCore::HttpHeaders; - mHttpMetricsHeaders->mHeaders.push_back("Content-Type: application/llsd+xml"); + mHttpMetricsHeaders->mHeaders.push_back(HTTP_HEADER_CONTENT_TYPE + ": " + HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicyDefault(); } @@ -3950,7 +3951,8 @@ void LLTextureFetchDebugger::init() if (! mHttpHeaders) { mHttpHeaders = new LLCore::HttpHeaders; - mHttpHeaders->mHeaders.push_back("Accept: image/x-j2c"); + // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? + mHttpHeaders->mHeaders.push_back(HTTP_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); } } -- cgit v1.2.3 From beeefb45269f45ea717f58b30a0985951ae23c20 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 4 Apr 2013 21:50:45 +0000 Subject: Renaming HTTP_HEADER_* into HTTP_IN_HEADER_* and HTTP_OUT_HEADER_* to make it more clear which header strings should be used for incoming vs outgoing situations. Using constants for commonly used llhttpnode context strings. --- indra/newview/lltexturefetch.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 9e9efa7ebd..cc6dc64626 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2408,9 +2408,9 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mHttpOptions = new LLCore::HttpOptions; mHttpHeaders = new LLCore::HttpHeaders; // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? - mHttpHeaders->mHeaders.push_back(HTTP_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); + mHttpHeaders->mHeaders.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); mHttpMetricsHeaders = new LLCore::HttpHeaders; - mHttpMetricsHeaders->mHeaders.push_back(HTTP_HEADER_CONTENT_TYPE + ": " + HTTP_CONTENT_LLSD_XML); + mHttpMetricsHeaders->mHeaders.push_back(HTTP_OUT_HEADER_CONTENT_TYPE + ": " + HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicyDefault(); } @@ -4043,7 +4043,7 @@ void LLTextureFetchDebugger::init() { mHttpHeaders = new LLCore::HttpHeaders; // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? - mHttpHeaders->mHeaders.push_back(HTTP_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); + mHttpHeaders->mHeaders.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); } } -- cgit v1.2.3 From 4bbcd26941c3be6b83214d0dc45c70f99e474dda Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 8 Apr 2013 18:16:58 -0400 Subject: SH-4061 FIX - texture fetch failures added retry logic and fault injection for testing --- indra/newview/lltexturefetch.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index cc6dc64626..2e6fb160d5 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -388,10 +388,12 @@ public: // 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); + F32 priority, S32 discard, S32 size, bool fake_failure); private: @@ -547,6 +549,7 @@ private: S32 mActiveCount; LLCore::HttpStatus mGetStatus; std::string mGetReason; + bool mFakeFailure; // Work Data LLMutex mWorkMutex; @@ -836,7 +839,8 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, const LLHost& host, // Simulator host F32 priority, // Priority S32 discard, // Desired discard - S32 size) // Desired size + S32 size, // Desired size + bool fake_failure) // For testing, simulate http failure if true. : LLWorkerClass(fetcher, "TextureFetch"), LLCore::HttpHandler(), mState(INIT), @@ -889,7 +893,8 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mHttpHasResource(false), mCacheReadCount(0U), mCacheWriteCount(0U), - mResourceWaitCount(0U) + mResourceWaitCount(0U), + mFakeFailure(fake_failure) { mCanUseNET = mUrl.empty() ; @@ -1519,15 +1524,16 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (http_not_found == mGetStatus) { + llwarns << "Texture missing from server (404): " << mUrl << llendl; + if(mWriteToCacheState == NOT_WRITE) //map tiles { setState(DONE); releaseHttpSemaphore(); - LL_DEBUGS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; + LL_WARNS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; return true; // failed, means no map tile on the empty region. } - llwarns << "Texture missing from server (404): " << mUrl << llendl; // roll back to try UDP if (mCanUseNET) @@ -1891,6 +1897,11 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); } + if (mFakeFailure) + { + llwarns << "For debugging, setting fake failure status for texture " << mID << llendl; + response->setStatus(LLCore::HttpStatus(404)); + } bool success = true; bool partial = false; LLCore::HttpStatus status(response->getStatus()); @@ -2455,7 +2466,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) + S32 w, S32 h, S32 c, S32 desired_discard, bool needs_aux, bool can_use_http, bool fake_failure) { if(mFetcherLocked) { @@ -2523,7 +2534,8 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->mNeedsAux = needs_aux; worker->setImagePriority(priority); worker->setDesiredDiscard(desired_discard, desired_size); - worker->setCanUseHTTP(can_use_http) ; + worker->setCanUseHTTP(can_use_http); + worker->setFakeFailure(fake_failure); if (!worker->haveWork()) { worker->setState(LLTextureFetchWorker::INIT); @@ -2538,7 +2550,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); + worker = new LLTextureFetchWorker(this, f_type, url, id, host, priority, desired_discard, desired_size, fake_failure); lockQueue(); // +Mfq mRequestMap[id] = worker; unlockQueue(); // -Mfq -- cgit v1.2.3 From f78da987913de659367b24e3aa0add2c570f8e1f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 10 Apr 2013 11:43:48 -0400 Subject: SH-4061 WIP - capture http status codes from requests, restrict SB fetch retries to 5xx errors --- indra/newview/lltexturefetch.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 2e6fb160d5..5a6338d9d8 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -382,6 +382,8 @@ public: void setCanUseHTTP(bool can_use_http) { mCanUseHTTP = can_use_http; } bool getCanUseHTTP() const { return mCanUseHTTP; } + void setUrl(const std::string& url) { mUrl = url; } + LLTextureFetch & getFetcher() { return *mFetcher; } // Inherited from LLCore::HttpHandler @@ -1291,7 +1293,7 @@ bool LLTextureFetchWorker::doWork(S32 param) std::string http_url = region->getHttpUrl() ; if (!http_url.empty()) { - mUrl = http_url + "/?texture_id=" + mID.asString().c_str(); + setUrl(http_url + "/?texture_id=" + mID.asString().c_str()); mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id. } else @@ -1900,7 +1902,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (mFakeFailure) { llwarns << "For debugging, setting fake failure status for texture " << mID << llendl; - response->setStatus(LLCore::HttpStatus(404)); + response->setStatus(LLCore::HttpStatus(500)); } bool success = true; bool partial = false; @@ -1918,11 +1920,11 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe // << " offset: " << offset << " length: " << length // << llendl; + std::string reason(status.toString()); + setGetStatus(status, reason); if (! status) { success = false; - std::string reason(status.toString()); - setGetStatus(status, reason); llwarns << "CURL GET FAILED, status: " << status.toHex() << " reason: " << reason << llendl; } @@ -2535,6 +2537,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->setImagePriority(priority); worker->setDesiredDiscard(desired_discard, desired_size); worker->setCanUseHTTP(can_use_http); + worker->setUrl(url); worker->setFakeFailure(fake_failure); if (!worker->haveWork()) { @@ -2741,7 +2744,8 @@ LLTextureFetchWorker* LLTextureFetch::getWorker(const LLUUID& id) // Threads: T* bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, - LLPointer& raw, LLPointer& aux) + LLPointer& raw, LLPointer& aux, + LLCore::HttpStatus& last_http_get_status) { bool res = false; LLTextureFetchWorker* worker = getWorker(id); @@ -2763,6 +2767,7 @@ bool LLTextureFetch::getRequestFinished(const LLUUID& id, S32& discard_level, else if (worker->checkWork()) { worker->lockWorkMutex(); // +Mw + last_http_get_status = worker->mGetStatus; discard_level = worker->mDecodedDiscard; raw = worker->mRawImage; aux = worker->mAuxImage; -- cgit v1.2.3 From 34e2478388341a1add33bf88cac43031e351340e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 10 Apr 2013 11:57:22 -0400 Subject: SH-4061 WIP - less log spamming for (expected and normal) map tile failures. --- indra/newview/lltexturefetch.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 5a6338d9d8..58cfc80839 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1526,14 +1526,20 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (http_not_found == mGetStatus) { - llwarns << "Texture missing from server (404): " << mUrl << llendl; + if (mFTType != FTT_MAP_TILE) + { + llwarns << "Texture missing from server (404): " << mUrl << llendl; + } - if(mWriteToCacheState == NOT_WRITE) //map tiles + if(mWriteToCacheState == NOT_WRITE) //map tiles or server bakes { setState(DONE); releaseHttpSemaphore(); - LL_WARNS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; - return true; // failed, means no map tile on the empty region. + if (mFTType != FTT_MAP_TILE) + { + LL_WARNS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; + } + return true; } @@ -1925,8 +1931,11 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (! status) { success = false; - llwarns << "CURL GET FAILED, status: " << status.toHex() - << " reason: " << reason << llendl; + if (mFTType != FTT_MAP_TILE) // missing map tiles are normal, don't complain about them. + { + llwarns << "CURL GET FAILED, status: " << status.toHex() + << " reason: " << reason << llendl; + } } else { -- cgit v1.2.3 From e17920defbf1d39ecd9e88500ba268c59bb84008 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 11 Apr 2013 16:17:23 -0400 Subject: SH-4061 WIP - started adding retry to texture fetch, making retry policy compatible with old and new http libraries --- indra/newview/lltexturefetch.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 58cfc80839..026f36e205 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1918,6 +1918,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe << " status: " << status.toHex() << " '" << status.toString() << "'" << llendl; + // unsigned int offset(0), length(0), full_length(0); // response->getRange(&offset, &length, &full_length); // llwarns << "HTTP COMPLETE: " << mID << " handle: " << handle -- cgit v1.2.3 From 8868964b549822f260694c2bf26b903dbce8ed0a Mon Sep 17 00:00:00 2001 From: Monty Brandenberg Date: Mon, 15 Apr 2013 16:55:35 +0000 Subject: SH-4106 Significantly upgrade the HttpHeaders interface for SSB. Header container moves from a vector of raw lines to a vector of string pairs representing name/value pairs in headers. For incoming headers, we normalize the name to lowercase and trim it. Values are only left-trimmed. Outgoing headers are left as-is. Simple find() method for the common case, forward and reverse iterators for those few who need to do it themselves. The HTTP status line (e.g. 'HTTP/1.1 200 Ok') is no longer treated as a header to be returned to caller. Unit tests, as usual, were a bear but they absolutely ensured outgoing HTTP header conformance after the change. Grunt work paid off. LLTextureFetch was also given a second options structure for texture fetches. Same as the original but with header return to caller requested. Baked textures should use this, the other 20,000 texture fetch requests should continue to use the original. --- indra/newview/lltexturefetch.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index cc6dc64626..5e12c341d5 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2000&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2012, Linden Research, Inc. + * Copyright (C) 2012-2013, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -2376,6 +2376,7 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mQAMode(qa_mode), mHttpRequest(NULL), mHttpOptions(NULL), + mHttpOptionsWithHeaders(NULL), mHttpHeaders(NULL), mHttpMetricsHeaders(NULL), mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID), @@ -2406,11 +2407,13 @@ LLTextureFetch::LLTextureFetch(LLTextureCache* cache, LLImageDecodeThread* image mHttpRequest = new LLCore::HttpRequest; mHttpOptions = new LLCore::HttpOptions; + mHttpOptionsWithHeaders = new LLCore::HttpOptions; + mHttpOptionsWithHeaders->setWantHeaders(true); mHttpHeaders = new LLCore::HttpHeaders; // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? - mHttpHeaders->mHeaders.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); + mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_IMAGE_X_J2C); mHttpMetricsHeaders = new LLCore::HttpHeaders; - mHttpMetricsHeaders->mHeaders.push_back(HTTP_OUT_HEADER_CONTENT_TYPE + ": " + HTTP_CONTENT_LLSD_XML); + mHttpMetricsHeaders->append(HTTP_OUT_HEADER_CONTENT_TYPE, HTTP_CONTENT_LLSD_XML); mHttpPolicyClass = LLAppViewer::instance()->getAppCoreHttp().getPolicyDefault(); } @@ -2431,6 +2434,12 @@ LLTextureFetch::~LLTextureFetch() mHttpOptions = NULL; } + if (mHttpOptionsWithHeaders) + { + mHttpOptionsWithHeaders->release(); + mHttpOptionsWithHeaders = NULL; + } + if (mHttpHeaders) { mHttpHeaders->release(); @@ -4043,7 +4052,7 @@ void LLTextureFetchDebugger::init() { mHttpHeaders = new LLCore::HttpHeaders; // *TODO: Should this be 'image/j2c' instead of 'image/x-j2c' ? - mHttpHeaders->mHeaders.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_IMAGE_X_J2C); + mHttpHeaders->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_IMAGE_X_J2C); } } -- cgit v1.2.3 From 5976dc144e774ae363cbf774337ccf663015cc6d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Apr 2013 15:12:22 -0400 Subject: SH-4061 WIP - simulated failures/image fetch retries --- indra/newview/lltexturefetch.cpp | 113 +++++++++++++++++++++++++++++++-------- 1 file changed, 90 insertions(+), 23 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 026f36e205..8e78638c0a 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -63,6 +63,8 @@ #include "bufferarray.h" #include "bufferstream.h" +#include "llhttpretrypolicy.h" + bool LLTextureFetchDebugger::sDebuggerEnabled = false ; LLStat LLTextureFetch::sCacheHitRate("texture_cache_hits", 128); LLStat LLTextureFetch::sCacheReadLatency("texture_cache_read_latency", 128); @@ -244,6 +246,25 @@ static const S32 HTTP_REQUESTS_IN_QUEUE_LOW_WATER = 20; // Active level at whi ////////////////////////////////////////////////////////////////////////////// +static const char* e_state_name[] = +{ + "INVALID", + "INIT", + "LOAD_FROM_TEXTURE_CACHE", + "CACHE_POST", + "LOAD_FROM_NETWORK", + "LOAD_FROM_SIMULATOR", + "WAIT_HTTP_RESOURCE", + "WAIT_HTTP_RESOURCE2", + "SEND_HTTP_REQ", + "WAIT_HTTP_REQ", + "DECODE_IMAGE", + "DECODE_IMAGE_UPDATE", + "WRITE_TO_CACHE", + "WAIT_ON_WRITE", + "DONE" +}; + class LLTextureFetchWorker : public LLWorkerClass, public LLCore::HttpHandler { @@ -552,6 +573,8 @@ private: LLCore::HttpStatus mGetStatus; std::string mGetReason; bool mFakeFailure; + LLAdaptiveRetryPolicy mFetchRetryPolicy; + // Work Data LLMutex mWorkMutex; @@ -896,7 +919,8 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mCacheReadCount(0U), mCacheWriteCount(0U), mResourceWaitCount(0U), - mFakeFailure(fake_failure) + mFakeFailure(fake_failure), + mFetchRetryPolicy(15.0,15.0,1.0,10) { mCanUseNET = mUrl.empty() ; @@ -1277,6 +1301,20 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mState == LOAD_FROM_NETWORK) { + // Check for retries to previous server failures. + F32 wait_seconds; + if (mFetchRetryPolicy.shouldRetry(wait_seconds)) + { + if (wait_seconds <= 0.0) + { + llinfos << mID << " retrying now" << llendl; + } + else + { + //llinfos << mID << " waiting to retry for " << wait_seconds << " seconds" << llendl; + return false; + } + } static LLCachedControl use_http(gSavedSettings,"ImagePipelineUseHTTP"); // if (mHost != LLHost::invalid) get_url = false; @@ -1557,6 +1595,10 @@ bool LLTextureFetchWorker::doWork(S32 param) else if (http_service_unavail == mGetStatus) { LL_INFOS_ONCE("Texture") << "Texture server busy (503): " << mUrl << LL_ENDL; + llinfos << "503: HTTP GET failed for: " << mUrl + << " Status: " << mGetStatus.toHex() + << " Reason: '" << mGetReason << "'" + << llendl; } else if (http_not_sat == mGetStatus) { @@ -1565,11 +1607,29 @@ bool LLTextureFetchWorker::doWork(S32 param) } else { - llinfos << "HTTP GET failed for: " << mUrl + llinfos << "other: HTTP GET failed for: " << mUrl << " Status: " << mGetStatus.toHex() << " Reason: '" << mGetReason << "'" << llendl; } +#if 0 + if (isHttpServerErrorStatus(mGetStatus.mType)) + { + // Check for retry + F32 wait_seconds; + if (mFetchRetryPolicy.shouldRetry(wait_seconds)) + { + llinfos << mID << " status " << (S32) mGetStatus.mType << " will retry after " << wait_seconds << llendl; + setState(INIT); + releaseHttpSemaphore(); + return false; + } + else + { + llinfos << mID << " will not retry on status " << (S32) mGetStatus.mType << llendl; + } + } +#endif mUrl.clear(); if (cur_size > 0) @@ -1907,12 +1967,33 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe if (mFakeFailure) { - llwarns << "For debugging, setting fake failure status for texture " << mID << llendl; + llwarns << mID << " for debugging, setting fake failure status for texture " << mID << llendl; response->setStatus(LLCore::HttpStatus(500)); + setFakeFailure(false); } bool success = true; bool partial = false; LLCore::HttpStatus status(response->getStatus()); + if (!status && (mFTType == FTT_SERVER_BAKE)) + { + llinfos << mID << " state " << e_state_name[mState] << llendl; + mFetchRetryPolicy.onFailure(response); + F32 retry_after; + if (mFetchRetryPolicy.shouldRetry(retry_after)) + { + llinfos << mID << " should retry after " << retry_after << ", resetting state to INIT" << llendl; + mFetcher->removeFromHTTPQueue(mID, 0); + std::string reason(status.toString()); + setGetStatus(status, reason); + releaseHttpSemaphore(); + setState(INIT); + return; + } + else + { + llinfos << mID << " should not retry" << llendl; + } + } LL_DEBUGS("Texture") << "HTTP COMPLETE: " << mID << " status: " << status.toHex() @@ -1934,7 +2015,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe success = false; if (mFTType != FTT_MAP_TILE) // missing map tiles are normal, don't complain about them. { - llwarns << "CURL GET FAILED, status: " << status.toHex() + llwarns << mID << " CURL GET FAILED, status: " << status.toHex() << " reason: " << reason << llendl; } } @@ -2488,7 +2569,11 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const { return false; } - + + if (f_type == FTT_SERVER_BAKE) + { + llinfos << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << llendl; + } LLTextureFetchWorker* worker = getWorker(id) ; if (worker) { @@ -3248,24 +3333,6 @@ bool LLTextureFetchWorker::insertPacket(S32 index, U8* data, S32 size) void LLTextureFetchWorker::setState(e_state new_state) { - static const char* e_state_name[] = - { - "INVALID", - "INIT", - "LOAD_FROM_TEXTURE_CACHE", - "CACHE_POST", - "LOAD_FROM_NETWORK", - "LOAD_FROM_SIMULATOR", - "WAIT_HTTP_RESOURCE", - "WAIT_HTTP_RESOURCE2", - "SEND_HTTP_REQ", - "WAIT_HTTP_REQ", - "DECODE_IMAGE", - "DECODE_IMAGE_UPDATE", - "WRITE_TO_CACHE", - "WAIT_ON_WRITE", - "DONE" - }; 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; } -- cgit v1.2.3 From 7182203ebf4ba914c3a49f9593b1ed831fa6c1e9 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Apr 2013 17:46:28 -0400 Subject: SH-4061 WIP - moved all retry logic into lltexturefetch, some cleanup. Debug setting now defines a fake failure rate. --- indra/newview/lltexturefetch.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') 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 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 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; } -- cgit v1.2.3 From 68cdbf387cf876da8833157b76048991120dc3f6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 15 Apr 2013 18:03:31 -0400 Subject: SH-4061 WIP - comments, timing of retries --- indra/newview/lltexturefetch.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 2cebd4b6eb..7b719190a4 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -915,7 +915,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, mCacheReadCount(0U), mCacheWriteCount(0U), mResourceWaitCount(0U), - mFetchRetryPolicy(15.0,15.0,1.0,10) + mFetchRetryPolicy(10.0,3600.0,2.0,10) { mCanUseNET = mUrl.empty() ; @@ -1981,7 +1981,7 @@ 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 LOAD_FROM_NETWORK" << llendl; + llinfos << mID << " will retry after " << retry_after << " seconds, resetting state to LOAD_FROM_NETWORK" << llendl; mFetcher->removeFromHTTPQueue(mID, 0); std::string reason(status.toString()); setGetStatus(status, reason); @@ -1991,7 +1991,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe } else { - llinfos << mID << " should not retry" << llendl; + llinfos << mID << " will not retry" << llendl; } } @@ -3334,9 +3334,12 @@ void LLTextureFetchWorker::setState(e_state new_state) { if (mFTType == FTT_SERVER_BAKE) { + // NOTE: turning on these log statements is a reliable way to get + // blurry images fairly frequently. Presumably this is an + // indication of some subtle timing or locking issue. + // 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; } -- cgit v1.2.3 From 9cbbb45a0ca8a56707125cdb3f6ea95de7f9deef Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 16 Apr 2013 09:19:35 -0400 Subject: SH-4061 WIP - cleanup --- indra/newview/lltexturefetch.cpp | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index ce7bd61ce4..1a6a308230 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1609,24 +1609,6 @@ bool LLTextureFetchWorker::doWork(S32 param) << " Reason: '" << mGetReason << "'" << llendl; } -#if 0 - if (isHttpServerErrorStatus(mGetStatus.mType)) - { - // Check for retry - F32 wait_seconds; - if (mFetchRetryPolicy.shouldRetry(wait_seconds)) - { - llinfos << mID << " status " << (S32) mGetStatus.mType << " will retry after " << wait_seconds << llendl; - setState(INIT); - releaseHttpSemaphore(); - return false; - } - else - { - llinfos << mID << " will not retry on status " << (S32) mGetStatus.mType << llendl; - } - } -#endif mUrl.clear(); if (cur_size > 0) -- cgit v1.2.3 From e3bad9fb86c3f44ad67488402ce2e46743a2422e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 16 Apr 2013 20:27:49 -0400 Subject: SH-4061 WIP - fix for build issues on mac, reset the retry policy on success. --- indra/newview/lltexturefetch.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 1a6a308230..774c925fa1 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1976,6 +1976,10 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe llinfos << mID << " will not retry" << llendl; } } + else + { + mFetchRetryPolicy.onSuccess(); + } LL_DEBUGS("Texture") << "HTTP COMPLETE: " << mID << " status: " << status.toHex() -- cgit v1.2.3 From b224b8978adfd42c89e1c66bc5495ead8fa1e85d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 17 Apr 2013 11:32:23 -0400 Subject: SH-4061 WIP - request headers for server-bake images --- indra/newview/lltexturefetch.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 774c925fa1..346374ef4e 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1524,12 +1524,14 @@ bool LLTextureFetchWorker::doWork(S32 param) << LL_ENDL; // Will call callbackHttpGet when curl request completes + // Only server bake images use the returned headers currently, for getting retry-after field. + HttpOptions *options = (mFTType == FTT_SERVER_BAKE) ? mFetcher->mHttpOptionsWithHeaders: mFetcher->mHttpOptions; mHttpHandle = mFetcher->mHttpRequest->requestGetByteRange(mHttpPolicyClass, mWorkPriority, mUrl, mRequestedOffset, mRequestedSize, - mFetcher->mHttpOptions, + options, mFetcher->mHttpHeaders, this); } -- cgit v1.2.3 From 17af76fae18e305d0a42192a326648f00c84d1f3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 18 Apr 2013 13:56:16 -0400 Subject: SH-4128 WIP - use the AISv3 inventory cap when available for cof link deletion, hook in to callback mechanism so all link operations should be done before outfit is worn. --- indra/newview/lltexturefetch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 346374ef4e..f7fbb19bdc 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1525,7 +1525,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // Will call callbackHttpGet when curl request completes // Only server bake images use the returned headers currently, for getting retry-after field. - HttpOptions *options = (mFTType == FTT_SERVER_BAKE) ? mFetcher->mHttpOptionsWithHeaders: mFetcher->mHttpOptions; + LLCore::HttpOptions *options = (mFTType == FTT_SERVER_BAKE) ? mFetcher->mHttpOptionsWithHeaders: mFetcher->mHttpOptions; mHttpHandle = mFetcher->mHttpRequest->requestGetByteRange(mHttpPolicyClass, mWorkPriority, mUrl, @@ -2569,7 +2569,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const if (f_type == FTT_SERVER_BAKE) { - llinfos << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << llendl; + LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << llendl; } LLTextureFetchWorker* worker = getWorker(id) ; if (worker) -- cgit v1.2.3 From 56cf4297f3c603b8c39880ee20ce0fd6fb3341e5 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 13 Jun 2013 16:07:02 -0400 Subject: SH-4250 WIP - logging tweaks and cleanup --- indra/newview/lltexturefetch.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index f7fbb19bdc..70e2c0f2dc 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1382,7 +1382,6 @@ bool LLTextureFetchWorker::doWork(S32 param) //recordTextureStart(false); //setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); - LL_DEBUGS("Texture") << mID << " does this happen?" << llendl; return false; } } @@ -2656,7 +2655,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const worker->unlockWorkMutex(); // -Mw } - LL_DEBUGS("Texture") << "REQUESTED: " << id << " Discard: " << desired_discard << " size " << desired_size << llendl; + LL_DEBUGS("Texture") << "REQUESTED: " << id << " f_type " << fttype_to_string(f_type) << " Discard: " << desired_discard << " size " << desired_size << llendl; return true; } -- cgit v1.2.3 From 2b8dc4d80c973770256d0d765f5d8f4f51cf9d57 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 7 Nov 2013 10:18:50 -0700 Subject: fix for SH-3959: Make sure baked textures cache and load from cache correctly. --- indra/newview/lltexturefetch.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 70e2c0f2dc..7d17aacfe7 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1205,9 +1205,7 @@ bool LLTextureFetchWorker::doWork(S32 param) offset, size, responder); mCacheReadTimer.reset(); } -/* SH-3980 - disabling caching of server bakes until we can fix the blurring problems */ -/* else if ((mUrl.empty()||mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache()) */ - else if (mUrl.empty() && mFetcher->canLoadFromCache()) + else if ((mUrl.empty() || mFTType==FTT_SERVER_BAKE) && mFetcher->canLoadFromCache()) { setPriority(LLWorkerThread::PRIORITY_LOW | mWorkPriority); // Set priority first since Responder may change it @@ -1343,12 +1341,11 @@ bool LLTextureFetchWorker::doWork(S32 param) mCanUseHTTP = false; } } -#if 0 /* SH-3980 - disabling caching of server bakes until we can fix the blurring problems */ - if (mFTType == FTT_SERVER_BAKE) + else if (mFTType == FTT_SERVER_BAKE) { mWriteToCacheState = CAN_WRITE; } -#endif + if (mCanUseHTTP && !mUrl.empty()) { setState(WAIT_HTTP_RESOURCE); -- cgit v1.2.3 From 9fe7ec50e0cf4d743b05e335ee27d6fb7fbe37b7 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Nov 2013 12:49:51 -0500 Subject: SH-4030 FIX --- indra/newview/lltexturefetch.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/newview/lltexturefetch.cpp (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp old mode 100644 new mode 100755 index 7d17aacfe7..4b9db53bc8 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -2582,7 +2582,18 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const S32 desired_size; std::string exten = gDirUtilp->getExtension(url); - if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)) + if (f_type == FTT_SERVER_BAKE) + { + // SH-4030: This case should be redundant with the following one, just + // breaking it out here to clarify that it's intended behavior. + llassert(!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)); + + // Do full requests for baked textures to reduce interim blurring. + LL_DEBUGS("Texture") << "full request for " << id << " texture is FTT_SERVER_BAKE" << llendl; + desired_size = MAX_IMAGE_DATA_SIZE; + desired_discard = 0; + } + else if (!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)) { LL_DEBUGS("Texture") << "full request for " << id << " exten is not J2C: " << exten << llendl; // Only do partial requests for J2C at the moment -- cgit v1.2.3 From 0384d579726e61b4239880df9fddb502afe65f5a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Nov 2013 16:21:34 -0500 Subject: SH-4611 WIP --- indra/newview/lltexturefetch.cpp | 78 +++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 4b9db53bc8..a86cf1fd4b 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1326,6 +1326,10 @@ bool LLTextureFetchWorker::doWork(S32 param) std::string http_url = region->getHttpUrl() ; if (!http_url.empty()) { + if (mFTType != FTT_DEFAULT) + { + llwarns << "trying to seek a non-default texture on the sim. Bad!" << llendl; + } setUrl(http_url + "/?texture_id=" + mID.asString().c_str()); mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id. } @@ -1814,7 +1818,7 @@ bool LLTextureFetchWorker::doWork(S32 param) if (mCachedSize > 0 && !mInLocalCache && mRetryAttempt == 0) { // Cache file should be deleted, try again -// llwarns << mID << ": Decode of cached file failed (removed), retrying" << llendl; + llwarns << mID << ": Decode of cached file failed (removed), retrying" << llendl; llassert_always(mDecodeHandle == 0); mFormattedImage = NULL; ++mRetryAttempt; @@ -2565,7 +2569,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const if (f_type == FTT_SERVER_BAKE) { - LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << llendl; + LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << llendl; } LLTextureFetchWorker* worker = getWorker(id) ; if (worker) @@ -4105,7 +4109,7 @@ LLTextureFetchDebugger::~LLTextureFetchDebugger() void LLTextureFetchDebugger::init() { - mState = IDLE; + setDebuggerState(IDLE); mCacheReadTime = -1.f; mCacheWriteTime = -1.f; @@ -4203,7 +4207,7 @@ void LLTextureFetchDebugger::startDebug() //clear the current fetching queue gTextureList.clearFetchingRequests(); - mState = START_DEBUG; + setDebuggerState(START_DEBUG); } bool LLTextureFetchDebugger::processStartDebug(F32 max_time) @@ -4278,7 +4282,7 @@ void LLTextureFetchDebugger::tryToStopDebug() //clear the current debug work S32 size = mFetchingHistory.size(); - switch(mState) + switch(mDebuggerState) { case READ_CACHE: for(S32 i = 0 ; i < size; i++) @@ -4351,7 +4355,7 @@ void LLTextureFetchDebugger::addHistoryEntry(LLTextureFetchWorker* worker) if(mFreezeHistory) { - if(mState == REFETCH_VIS_CACHE || mState == REFETCH_VIS_HTTP) + if(mDebuggerState == REFETCH_VIS_CACHE || mDebuggerState == REFETCH_VIS_HTTP) { mRefetchedVisPixels += worker->mRawImage->getWidth() * worker->mRawImage->getHeight(); mRefetchedVisData += worker->mFormattedImage->getDataSize(); @@ -4396,9 +4400,9 @@ void LLTextureFetchDebugger::unlockCache() void LLTextureFetchDebugger::debugCacheRead() { lockCache(); - llassert_always(mState == IDLE); + llassert_always(mDebuggerState == IDLE); mTimer.reset(); - mState = READ_CACHE; + setDebuggerState(READ_CACHE); mCacheReadTime = -1.f; S32 size = mFetchingHistory.size(); @@ -4432,9 +4436,9 @@ void LLTextureFetchDebugger::debugCacheWrite() clearCache(); lockCache(); - llassert_always(mState == IDLE); + llassert_always(mDebuggerState == IDLE); mTimer.reset(); - mState = WRITE_CACHE; + setDebuggerState(WRITE_CACHE); mCacheWriteTime = -1.f; S32 size = mFetchingHistory.size(); @@ -4461,9 +4465,9 @@ void LLTextureFetchDebugger::unlockDecoder() void LLTextureFetchDebugger::debugDecoder() { lockDecoder(); - llassert_always(mState == IDLE); + llassert_always(mDebuggerState == IDLE); mTimer.reset(); - mState = DECODING; + setDebuggerState(DECODING); mDecodingTime = -1.f; S32 size = mFetchingHistory.size(); @@ -4482,7 +4486,7 @@ void LLTextureFetchDebugger::debugDecoder() void LLTextureFetchDebugger::debugHTTP() { - llassert_always(mState == IDLE); + llassert_always(mDebuggerState == IDLE); LLViewerRegion* region = gAgent.getRegion(); if (!region) @@ -4499,7 +4503,7 @@ void LLTextureFetchDebugger::debugHTTP() } mTimer.reset(); - mState = HTTP_FETCHING; + setDebuggerState(HTTP_FETCHING); mHTTPTime = -1.f; S32 size = mFetchingHistory.size(); @@ -4579,8 +4583,8 @@ S32 LLTextureFetchDebugger::fillCurlQueue() void LLTextureFetchDebugger::debugGLTextureCreation() { - llassert_always(mState == IDLE); - mState = GL_TEX; + llassert_always(mDebuggerState == IDLE); + setDebuggerState(GL_TEX); mTempTexList.clear(); S32 size = mFetchingHistory.size(); @@ -4701,8 +4705,8 @@ void LLTextureFetchDebugger::scanRefetchList() void LLTextureFetchDebugger::debugRefetchVisibleFromCache() { - llassert_always(mState == IDLE); - mState = REFETCH_VIS_CACHE; + llassert_always(mDebuggerState == IDLE); + setDebuggerState(REFETCH_VIS_CACHE); clearTextures(); mFetcher->setLoadSource(LLTextureFetch::FROM_ALL); @@ -4716,8 +4720,8 @@ void LLTextureFetchDebugger::debugRefetchVisibleFromCache() void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() { - llassert_always(mState == IDLE); - mState = REFETCH_VIS_HTTP; + llassert_always(mDebuggerState == IDLE); + setDebuggerState(REFETCH_VIS_HTTP); clearTextures(); mFetcher->setLoadSource(LLTextureFetch::FROM_HTTP_ONLY); @@ -4731,8 +4735,8 @@ void LLTextureFetchDebugger::debugRefetchVisibleFromHTTP() void LLTextureFetchDebugger::debugRefetchAllFromCache() { - llassert_always(mState == IDLE); - mState = REFETCH_ALL_CACHE; + llassert_always(mDebuggerState == IDLE); + setDebuggerState(REFETCH_ALL_CACHE); clearTextures(); makeRefetchList(); @@ -4748,8 +4752,8 @@ void LLTextureFetchDebugger::debugRefetchAllFromCache() void LLTextureFetchDebugger::debugRefetchAllFromHTTP() { - llassert_always(mState == IDLE); - mState = REFETCH_ALL_HTTP; + llassert_always(mDebuggerState == IDLE); + setDebuggerState(REFETCH_ALL_HTTP); clearTextures(); makeRefetchList(); @@ -4765,19 +4769,19 @@ void LLTextureFetchDebugger::debugRefetchAllFromHTTP() bool LLTextureFetchDebugger::update(F32 max_time) { - switch(mState) + switch(mDebuggerState) { case START_DEBUG: if(processStartDebug(max_time)) { - mState = IDLE; + setDebuggerState(IDLE); } break; case READ_CACHE: if(!mTextureCache->update(1)) { mCacheReadTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); unlockCache(); } break; @@ -4785,7 +4789,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) if(!mTextureCache->update(1)) { mCacheWriteTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); unlockCache(); } break; @@ -4793,7 +4797,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) if(!mImageDecodeThread->update(1)) { mDecodingTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); unlockDecoder(); } break; @@ -4803,13 +4807,13 @@ bool LLTextureFetchDebugger::update(F32 max_time) if (!fillCurlQueue() && mNbCurlCompleted == mFetchingHistory.size()) { mHTTPTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); } break; case GL_TEX: if(processGLCreation(max_time)) { - mState = IDLE; + setDebuggerState(IDLE); mTempTexList.clear(); } break; @@ -4817,7 +4821,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) { mRefetchVisCacheTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); mFetcher->lockFetcher(true); mFetcher->resetLoadSource(); } @@ -4826,7 +4830,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) { mRefetchVisHTTPTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); mFetcher->lockFetcher(true); mFetcher->resetLoadSource(); } @@ -4843,7 +4847,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) } mRefetchAllCacheTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); mFetcher->lockFetcher(true); mFetcher->resetLoadSource(); mRefetchList.clear(); @@ -4855,7 +4859,7 @@ bool LLTextureFetchDebugger::update(F32 max_time) if (LLAppViewer::getTextureFetch()->getNumRequests() == 0) { mRefetchAllHTTPTime = mTimer.getElapsedTimeF32() ; - mState = IDLE; + setDebuggerState(IDLE); mFetcher->lockFetcher(true); mFetcher->resetLoadSource(); mRefetchList.clear(); @@ -4863,11 +4867,11 @@ bool LLTextureFetchDebugger::update(F32 max_time) } break; default: - mState = IDLE; + setDebuggerState(IDLE); break; } - return mState == IDLE; + return mDebuggerState == IDLE; } void LLTextureFetchDebugger::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response) -- cgit v1.2.3 From 4724232abd2aa88cdd592be6f5aa287ed70af1aa Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 5 Dec 2013 13:24:38 -0500 Subject: SH-4611 WIP - this should prevent the case logged, which I believe is caused when cache loading fails. Can not repro so somewhat speculative. --- indra/newview/lltexturefetch.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index d9c2c7d279..12c83ce28f 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1612,7 +1612,10 @@ bool LLTextureFetchWorker::doWork(S32 param) << llendl; } - mUrl.clear(); + if (mFTType != FTT_SERVER_BAKE) + { + mUrl.clear(); + } if (cur_size > 0) { // Use available data @@ -1639,7 +1642,7 @@ bool LLTextureFetchWorker::doWork(S32 param) // Clear the url since we're done with the fetch // Note: mUrl is used to check is fetching is required so failure to clear it will force an http fetch // next time the texture is requested, even if the data have already been fetched. - if(mWriteToCacheState != NOT_WRITE) + if(mWriteToCacheState != NOT_WRITE && mFTType != FTT_SERVER_BAKE) { // Why do we want to keep url if NOT_WRITE - is this a proxy for map tiles? mUrl.clear(); -- cgit v1.2.3 From cc9a7a70b1971def1c53c70c96e8ce88fc5a7b86 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 17 Dec 2013 14:14:03 -0500 Subject: merge fix --- indra/newview/lltexturefetch.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 12c83ce28f..d0ab9f55ff 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1949,7 +1949,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe mFetcher->mTextureInfo.setRequestCompleteTimeAndLog(mID, timeNow); } - static LLCachedControl fake_failure_rate(gSavedSettings, "TextureFetchFakeFailureRate", 0.0); + static LLCachedControl fake_failure_rate(gSavedSettings, "TextureFetchFakeFailureRate", 0.0f); 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)) -- cgit v1.2.3 From 487ca1bad37883be0325b564ab557a8f77575388 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 14 May 2014 17:50:59 -0400 Subject: v-r -> s-e merge WIP --- indra/newview/lltexturefetch.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'indra/newview/lltexturefetch.cpp') diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index fb4be553c1..14a42dd8dc 100755 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1306,11 +1306,11 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (wait_seconds <= 0.0) { - llinfos << mID << " retrying now" << llendl; + LL_INFOS() << mID << " retrying now" << LL_ENDL; } else { - //llinfos << mID << " waiting to retry for " << wait_seconds << " seconds" << llendl; + //LL_INFOS() << mID << " waiting to retry for " << wait_seconds << " seconds" << LL_ENDL; return false; } } @@ -1333,7 +1333,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (mFTType != FTT_DEFAULT) { - llwarns << "trying to seek a non-default texture on the sim. Bad!" << llendl; + LL_WARNS() << "trying to seek a non-default texture on the sim. Bad!" << LL_ENDL; } setUrl(http_url + "/?texture_id=" + mID.asString().c_str()); mWriteToCacheState = CAN_WRITE ; //because this texture has a fixed texture id. @@ -1570,7 +1570,7 @@ bool LLTextureFetchWorker::doWork(S32 param) { if (mFTType != FTT_MAP_TILE) { - llwarns << "Texture missing from server (404): " << mUrl << llendl; + LL_WARNS() << "Texture missing from server (404): " << mUrl << LL_ENDL; } if(mWriteToCacheState == NOT_WRITE) //map tiles or server bakes @@ -1579,7 +1579,7 @@ bool LLTextureFetchWorker::doWork(S32 param) releaseHttpSemaphore(); if (mFTType != FTT_MAP_TILE) { - LL_WARNS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << llendl; + LL_WARNS("Texture") << mID << " abort: WAIT_HTTP_REQ not found" << LL_ENDL; } return true; } @@ -1598,10 +1598,10 @@ bool LLTextureFetchWorker::doWork(S32 param) else if (http_service_unavail == mGetStatus) { LL_INFOS_ONCE("Texture") << "Texture server busy (503): " << mUrl << LL_ENDL; - llinfos << "503: HTTP GET failed for: " << mUrl + LL_INFOS() << "503: HTTP GET failed for: " << mUrl << " Status: " << mGetStatus.toHex() << " Reason: '" << mGetReason << "'" - << llendl; + << LL_ENDL; } else if (http_not_sat == mGetStatus) { @@ -1957,8 +1957,8 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe 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 - << " (rand was " << rand_val << "/" << rate << ")" << llendl; + LL_WARNS() << mID << " for debugging, setting fake failure status for texture " << mID + << " (rand was " << rand_val << "/" << rate << ")" << LL_ENDL; response->setStatus(LLCore::HttpStatus(503)); } bool success = true; @@ -1966,13 +1966,13 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe LLCore::HttpStatus status(response->getStatus()); if (!status && (mFTType == FTT_SERVER_BAKE)) { - llinfos << mID << " state " << e_state_name[mState] << llendl; + LL_INFOS() << mID << " state " << e_state_name[mState] << LL_ENDL; mFetchRetryPolicy.onFailure(response); F32 retry_after; if (mFetchRetryPolicy.shouldRetry(retry_after)) { - llinfos << mID << " will retry after " << retry_after << " seconds, resetting state to LOAD_FROM_NETWORK" << llendl; - mFetcher->removeFromHTTPQueue(mID, 0); + LL_INFOS() << mID << " will retry after " << retry_after << " seconds, resetting state to LOAD_FROM_NETWORK" << LL_ENDL; + mFetcher->removeFromHTTPQueue(mID, S32Bytes(0)); std::string reason(status.toString()); setGetStatus(status, reason); releaseHttpSemaphore(); @@ -1981,7 +1981,7 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe } else { - llinfos << mID << " will not retry" << llendl; + LL_INFOS() << mID << " will not retry" << LL_ENDL; } } else @@ -2011,8 +2011,8 @@ void LLTextureFetchWorker::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRe { std::string reason(status.toString()); setGetStatus(status, reason); - llwarns << "CURL GET FAILED, status: " << status.toTerseString() - << " reason: " << reason << llendl; + LL_WARNS() << "CURL GET FAILED, status: " << status.toTerseString() + << " reason: " << reason << LL_ENDL; } } else @@ -2576,7 +2576,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const if (f_type == FTT_SERVER_BAKE) { - LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << llendl; + LL_DEBUGS("Avatar") << " requesting " << id << " " << w << "x" << h << " discard " << desired_discard << " type " << f_type << LL_ENDL; } LLTextureFetchWorker* worker = getWorker(id) ; if (worker) @@ -2600,7 +2600,7 @@ bool LLTextureFetch::createRequest(FTType f_type, const std::string& url, const llassert(!url.empty() && (!exten.empty() && LLImageBase::getCodecFromExtension(exten) != IMG_CODEC_J2C)); // Do full requests for baked textures to reduce interim blurring. - LL_DEBUGS("Texture") << "full request for " << id << " texture is FTT_SERVER_BAKE" << llendl; + LL_DEBUGS("Texture") << "full request for " << id << " texture is FTT_SERVER_BAKE" << LL_ENDL; desired_size = MAX_IMAGE_DATA_SIZE; desired_discard = 0; } @@ -3354,7 +3354,7 @@ void LLTextureFetchWorker::setState(e_state new_state) // blurry images fairly frequently. Presumably this is an // indication of some subtle timing or locking issue. -// LL_INFOS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << llendl; +// LL_INFOS("Texture") << "id: " << mID << " FTType: " << mFTType << " disc: " << mDesiredDiscard << " sz: " << mDesiredSize << " state: " << e_state_name[mState] << " => " << e_state_name[new_state] << LL_ENDL; } mState = new_state; } -- cgit v1.2.3