Merge asset-http

meow-7.2.2
Ansariel 2017-05-07 16:10:30 +02:00
commit f1cb7185f7
9 changed files with 155 additions and 62 deletions

View File

@ -1304,8 +1304,9 @@ Sovereign Engineer
MAINT-6107
STORM-2107
MAINT-6218
STORM-2143
MAINT-6913
STORM-2143
MAINT-7343
SpacedOut Frye
VWR-34
VWR-45

View File

@ -31,9 +31,6 @@
#include "llmemory.h"
#include "llsingleton.h"
#include <set>
#include <boost/algorithm/string.hpp>
///----------------------------------------------------------------------------
/// Class LLAssetType
///----------------------------------------------------------------------------

View File

@ -371,11 +371,11 @@ void LLAssetStorage::_cleanupRequests(BOOL all, S32 error)
|| ((RT_DOWNLOAD == rt)
&& LL_ASSET_STORAGE_TIMEOUT < (mt_secs - tmp->mTime)))
{
LL_WARNS() << "Asset " << getRequestName((ERequestType)rt) << " request "
<< (all ? "aborted" : "timed out") << " for "
<< tmp->getUUID() << "."
<< LLAssetType::lookup(tmp->getType()) << LL_ENDL;
LL_WARNS("AssetStorage") << "Asset " << getRequestName((ERequestType)rt) << " request "
<< (all ? "aborted" : "timed out") << " for "
<< tmp->getUUID() << "."
<< LLAssetType::lookup(tmp->getType()) << LL_ENDL;
timed_out.push_front(tmp);
iter = requests->erase(curiter);
}
@ -435,8 +435,8 @@ bool LLAssetStorage::findInStaticVFSAndInvokeCallback(const LLUUID& uuid, LLAsse
}
else
{
LL_WARNS() << "Asset vfile " << uuid << ":" << type
<< " found in static cache with bad size " << file.getSize() << ", ignoring" << LL_ENDL;
LL_WARNS("AssetStorage") << "Asset vfile " << uuid << ":" << type
<< " found in static cache with bad size " << file.getSize() << ", ignoring" << LL_ENDL;
}
}
return false;
@ -513,7 +513,7 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
{
if (exists)
{
LL_WARNS() << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
LL_WARNS("AssetStorage") << "Asset vfile " << uuid << ":" << type << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@ -529,8 +529,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid,
if (callback == tmp->mDownCallback && user_data == tmp->mUserData)
{
// this is a duplicate from the same subsystem - throw it away
LL_WARNS() << "Discarding duplicate request for asset " << uuid
<< "." << LLAssetType::lookup(type) << LL_ENDL;
LL_WARNS("AssetStorage") << "Discarding duplicate request for asset " << uuid
<< "." << LLAssetType::lookup(type) << LL_ENDL;
return;
}
@ -600,13 +600,13 @@ void LLAssetStorage::downloadCompleteCallback(
LLAssetRequest* req = (LLAssetRequest*)user_data;
if(!req)
{
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without"
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without"
"a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
return;
}
@ -637,7 +637,7 @@ void LLAssetStorage::downloadCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, callback_id, callback_type);
if (vfile.getSize() <= 0)
{
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL;
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset " << callback_id << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
@ -712,7 +712,7 @@ void LLAssetStorage::getEstateAsset(
{
if (exists)
{
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
LL_WARNS("AssetStorage") << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@ -752,7 +752,7 @@ void LLAssetStorage::getEstateAsset(
else
{
// uh-oh, we shouldn't have gotten here
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
LL_WARNS("AssetStorage") << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
add(sFailedDownloadCount, 1);
@ -772,13 +772,13 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
LLEstateAssetRequest *req = (LLEstateAssetRequest*)user_data;
if(!req)
{
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without any asset system, aborting!" << LL_ENDL;
return;
}
@ -791,7 +791,7 @@ void LLAssetStorage::downloadEstateAssetCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getAType());
if (vfile.getSize() <= 0)
{
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
@ -836,7 +836,7 @@ void LLAssetStorage::getInvItemAsset(
size = exists ? file.getSize() : 0;
if(exists && size < 1)
{
LL_WARNS() << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
LL_WARNS("AssetStorage") << "Asset vfile " << asset_id << ":" << atype << " found with bad size " << file.getSize() << ", removing" << LL_ENDL;
file.remove();
}
@ -896,7 +896,7 @@ void LLAssetStorage::getInvItemAsset(
else
{
// uh-oh, we shouldn't have gotten here
LL_WARNS() << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
LL_WARNS("AssetStorage") << "Attempt to move asset data request upstream w/o valid upstream provider" << LL_ENDL;
if (callback)
{
add(sFailedDownloadCount, 1);
@ -917,13 +917,13 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
LLInvItemRequest *req = (LLInvItemRequest*)user_data;
if(!req)
{
LL_WARNS() << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadEstateAssetCompleteCallback called"
" without a valid request." << LL_ENDL;
return;
}
if (!gAssetStorage)
{
LL_WARNS() << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
LL_WARNS("AssetStorage") << "LLAssetStorage::downloadCompleteCallback called without any asset system, aborting!" << LL_ENDL;
return;
}
@ -935,7 +935,7 @@ void LLAssetStorage::downloadInvItemCompleteCallback(
LLVFile vfile(gAssetStorage->mVFS, req->getUUID(), req->getType());
if (vfile.getSize() <= 0)
{
LL_WARNS() << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
LL_WARNS("AssetStorage") << "downloadCompleteCallback has non-existent or zero-size asset!" << LL_ENDL;
result = LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE;
vfile.remove();
@ -962,7 +962,7 @@ void LLAssetStorage::uploadCompleteCallback(
{
if (!gAssetStorage)
{
LL_WARNS() << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback has no gAssetStorage!" << LL_ENDL;
return;
}
LLAssetRequest *req = (LLAssetRequest *)user_data;
@ -970,7 +970,7 @@ void LLAssetStorage::uploadCompleteCallback(
if (result)
{
LL_WARNS() << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL;
LL_WARNS("AssetStorage") << "LLAssetStorage::uploadCompleteCallback " << result << ":" << getErrorString(result) << " trying to upload file to upstream provider" << LL_ENDL;
success = FALSE;
}
@ -1046,14 +1046,14 @@ LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStorage::E
switch (rt)
{
case RT_DOWNLOAD:
return &mPendingDownloads;
return &mPendingDownloads;
case RT_UPLOAD:
return &mPendingUploads;
return &mPendingUploads;
case RT_LOCALUPLOAD:
return &mPendingLocalUploads;
return &mPendingLocalUploads;
default:
LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
}
}
@ -1062,14 +1062,14 @@ const LLAssetStorage::request_list_t* LLAssetStorage::getRequestList(LLAssetStor
switch (rt)
{
case RT_DOWNLOAD:
return &mPendingDownloads;
return &mPendingDownloads;
case RT_UPLOAD:
return &mPendingUploads;
return &mPendingUploads;
case RT_LOCALUPLOAD:
return &mPendingLocalUploads;
return &mPendingLocalUploads;
default:
LL_WARNS() << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
LL_WARNS("AssetStorage") << "Unable to find request list for request type '" << rt << "'" << LL_ENDL;
return NULL;
}
}
@ -1079,14 +1079,14 @@ std::string LLAssetStorage::getRequestName(LLAssetStorage::ERequestType rt)
switch (rt)
{
case RT_DOWNLOAD:
return "download";
return "download";
case RT_UPLOAD:
return "upload";
return "upload";
case RT_LOCALUPLOAD:
return "localupload";
return "localupload";
default:
LL_WARNS() << "Unable to find request name for request type '" << rt << "'" << LL_ENDL;
return "";
LL_WARNS("AssetStorage") << "Unable to find request name for request type '" << rt << "'" << LL_ENDL;
return "";
}
}
@ -1277,37 +1277,37 @@ const char* LLAssetStorage::getErrorString(S32 status)
switch( status )
{
case LL_ERR_NOERR:
return "No error";
return "No error";
case LL_ERR_ASSET_REQUEST_FAILED:
return "Asset request: failed";
return "Asset request: failed";
case LL_ERR_ASSET_REQUEST_NONEXISTENT_FILE:
return "Asset request: non-existent file";
return "Asset request: non-existent file";
case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE:
return "Asset request: asset not found in database";
return "Asset request: asset not found in database";
case LL_ERR_EOF:
return "End of file";
return "End of file";
case LL_ERR_CANNOT_OPEN_FILE:
return "Cannot open file";
return "Cannot open file";
case LL_ERR_FILE_NOT_FOUND:
return "File not found";
return "File not found";
case LL_ERR_TCP_TIMEOUT:
return "File transfer timeout";
return "File transfer timeout";
case LL_ERR_CIRCUIT_GONE:
return "Circuit gone";
return "Circuit gone";
case LL_ERR_PRICE_MISMATCH:
return "Viewer and server do not agree on price";
return "Viewer and server do not agree on price";
default:
return "Unknown status";
return "Unknown status";
}
}

View File

@ -253,6 +253,8 @@ public:
bool user_waiting= false,
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) = 0;
virtual void logAssetStorageInfo() = 0;
void checkForTimeouts();
void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,

View File

@ -17847,6 +17847,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>AssetStorageLogFrequency</key>
<map>
<key>Comment</key>
<string>Seconds between display of AssetStorage info in log (0 for never)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>60.0</real>
</map>
<key>LogWearableAssetSave</key>
<map>
<key>Comment</key>
@ -17926,6 +17937,15 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<real>1</real>
</map>
<key>PoolSizeAssetStorage</key>
<map>
<key>Comment</key>
<string>Coroutine Pool size for AssetStorage requests</string>
<key>Type</key>
<string>U32</string>
<key>Value</key>
<real>12</real>
</map>
<!-- Settings below are for back compatibility only.
They are not used in current viewer anymore. But they can't be removed to avoid

View File

@ -1449,7 +1449,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
F64 byte_count = 0;
for (S32 i=mFirstPacket; i<=mLastPacket; i++)
{
byte_count += mPackets[i]->mSize;
if (mPackets[i])
{
byte_count += mPackets[i]->mSize;
}
}
LL_DEBUGS(LOG_TXT) << mID << ": Loaded from Sim. Bytes: " << mFormattedImage->getDataSize() << LL_ENDL;

View File

@ -40,6 +40,7 @@
#include "lltransfertargetvfile.h"
#include "llviewerassetstats.h"
#include "llcoros.h"
#include "llcoproceduremanager.h"
#include "lleventcoro.h"
#include "llsdutil.h"
#include "llworld.h"
@ -101,17 +102,30 @@ public:
/// LLViewerAssetStorage
///----------------------------------------------------------------------------
// Unused?
LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs,
const LLHost &upstream_host)
: LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host)
: LLAssetStorage(msg, xfer, vfs, static_vfs, upstream_host),
mAssetCoroCount(0),
mCountRequests(0),
mCountStarted(0),
mCountCompleted(0),
mCountSucceeded(0),
mTotalBytesFetched(0)
{
}
LLViewerAssetStorage::LLViewerAssetStorage(LLMessageSystem *msg, LLXferManager *xfer,
LLVFS *vfs, LLVFS *static_vfs)
: LLAssetStorage(msg, xfer, vfs, static_vfs)
: LLAssetStorage(msg, xfer, vfs, static_vfs),
mAssetCoroCount(0),
mCountRequests(0),
mCountStarted(0),
mCountCompleted(0),
mCountSucceeded(0),
mTotalBytesFetched(0)
{
}
@ -354,6 +368,7 @@ void LLViewerAssetStorage::_queueDataRequest(
BOOL duplicate,
BOOL is_priority)
{
mCountRequests++;
queueRequestHttp(uuid, atype, callback, user_data, duplicate, is_priority);
}
@ -389,8 +404,8 @@ void LLViewerAssetStorage::queueRequestHttp(
//LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
// <FS:Ansariel> [UDP Assets]
LLCoros::instance().launch("LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
LLCoprocedureManager::instance().enqueueCoprocedure("AssetStorage","LLViewerAssetStorage::assetRequestCoro",
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
}
}
@ -409,13 +424,30 @@ void LLViewerAssetStorage::capsRecvForRegion(const LLUUID& region_id, std::strin
LLEventPumps::instance().obtain(pumpname).post(LLSD());
}
struct LLScopedIncrement
{
LLScopedIncrement(S32& counter):
mCounter(counter)
{
++mCounter;
}
~LLScopedIncrement()
{
--mCounter;
}
S32& mCounter;
};
void LLViewerAssetStorage::assetRequestCoro(
LLViewerAssetRequest *req,
const LLUUID& uuid,
const LLUUID uuid,
LLAssetType::EType atype,
LLGetAssetCallback callback,
void *user_data)
{
LLScopedIncrement coro_count_boost(mAssetCoroCount);
mCountStarted++;
S32 result_code = LL_ERR_NOERR;
LLExtStat ext_status = LL_EXSTAT_NONE;
@ -499,6 +531,14 @@ void LLViewerAssetStorage::assetRequestCoro(
LLSD result = httpAdapter->getRawAndSuspend(httpRequest, url, httpOpts);
if (LLApp::isQuitting())
{
// Bail out if result arrives after shutdown has been started.
return;
}
mCountCompleted++;
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
if (!status)
@ -516,6 +556,8 @@ void LLViewerAssetStorage::assetRequestCoro(
S32 size = raw.size();
if (size > 0)
{
mTotalBytesFetched += size;
// This create-then-rename flow is modeled on
// LLTransferTargetVFile, which is what's used in the UDP
// case.
@ -537,6 +579,7 @@ void LLViewerAssetStorage::assetRequestCoro(
result_code = LL_ERR_ASSET_REQUEST_FAILED;
ext_status = LL_EXSTAT_VFS_CORRUPT;
}
mCountSucceeded++;
}
else
{
@ -557,3 +600,14 @@ std::string LLViewerAssetStorage::getAssetURL(const std::string& cap_url, const
std::string url = cap_url + "/?" + type_name + "_id=" + uuid.asString();
return url;
}
void LLViewerAssetStorage::logAssetStorageInfo()
{
LLMemory::logMemoryInfo(true);
LL_INFOS("AssetStorage") << "Active coros " << mAssetCoroCount << LL_ENDL;
LL_INFOS("AssetStorage") << "mPendingDownloads size " << mPendingDownloads.size() << LL_ENDL;
LL_INFOS("AssetStorage") << "mCountStarted " << mCountStarted << LL_ENDL;
LL_INFOS("AssetStorage") << "mCountCompleted " << mCountCompleted << LL_ENDL;
LL_INFOS("AssetStorage") << "mCountSucceeded " << mCountSucceeded << LL_ENDL;
LL_INFOS("AssetStorage") << "mTotalBytesFetched " << mTotalBytesFetched << LL_ENDL;
}

View File

@ -28,6 +28,7 @@
#define LLVIEWERASSETSTORAGE_H
#include "llassetstorage.h"
#include "llcorehttputil.h"
class LLVFile;
@ -83,14 +84,22 @@ protected:
void capsRecvForRegion(const LLUUID& region_id, std::string pumpname);
void assetRequestCoro(LLViewerAssetRequest *req,
const LLUUID& uuid,
const LLUUID uuid,
LLAssetType::EType atype,
void (*callback) (LLVFS *vfs, const LLUUID&, LLAssetType::EType, void *, S32, LLExtStat),
void *user_data);
std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype);
void logAssetStorageInfo();
std::string mViewerAssetUrl;
S32 mAssetCoroCount;
S32 mCountRequests;
S32 mCountStarted;
S32 mCountCompleted;
S32 mCountSucceeded;
S64 mTotalBytesFetched;
};
#endif

View File

@ -113,6 +113,7 @@ const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f;
U32 gRecentFrameCount = 0; // number of 'recent' frames
LLFrameTimer gRecentFPSTime;
LLFrameTimer gRecentMemoryTime;
LLFrameTimer gAssetStorageLogTime;
// Rendering stuff
void pre_show_depth_buffer();
@ -248,6 +249,12 @@ void display_stats()
LLMemory::logMemoryInfo(TRUE) ;
gRecentMemoryTime.reset();
}
F32 asset_storage_log_freq = gSavedSettings.getF32("AssetStorageLogFrequency");
if (asset_storage_log_freq > 0.f && gAssetStorageLogTime.getElapsedTimeF32() >= asset_storage_log_freq)
{
gAssetStorageLogTime.reset();
gAssetStorage->logAssetStorageInfo();
}
}
static LLTrace::BlockTimerStatHandle FTM_PICK("Picking");