SL-14399 Enqueue into 'LLViewerAssetStorage::assetRequestCoro' failed
parent
47bd603ceb
commit
71bca1d860
|
|
@ -262,7 +262,7 @@ public:
|
|||
|
||||
virtual void logAssetStorageInfo() = 0;
|
||||
|
||||
void checkForTimeouts();
|
||||
virtual void checkForTimeouts();
|
||||
|
||||
void getEstateAsset(const LLHost &object_sim, const LLUUID &agent_id, const LLUUID &session_id,
|
||||
const LLUUID &asset_id, LLAssetType::EType atype, EstateAssetType etype,
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ static const std::map<std::string, U32> DefaultPoolSizes{
|
|||
};
|
||||
|
||||
static const U32 DEFAULT_POOL_SIZE = 5;
|
||||
static const U32 DEFAULT_QUEUE_SIZE = 4096;
|
||||
const U32 LLCoprocedureManager::DEFAULT_QUEUE_SIZE = 4096;
|
||||
|
||||
//=========================================================================
|
||||
class LLCoprocedurePool: private boost::noncopyable
|
||||
|
|
@ -194,7 +194,7 @@ void LLCoprocedureManager::setPropertyMethods(SettingQuery_t queryfn, SettingUpd
|
|||
mPropertyDefineFn = updatefn;
|
||||
|
||||
// workaround until we get mutex into initializePool
|
||||
initializePool("VAssetStorage");
|
||||
initializePool("AssetStorage");
|
||||
initializePool("Upload");
|
||||
}
|
||||
|
||||
|
|
@ -281,7 +281,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
|
|||
mPoolSize(size),
|
||||
mActiveCoprocsCount(0),
|
||||
mPending(0),
|
||||
mPendingCoprocs(boost::make_shared<CoprocQueue_t>(DEFAULT_QUEUE_SIZE)),
|
||||
mPendingCoprocs(boost::make_shared<CoprocQueue_t>(LLCoprocedureManager::DEFAULT_QUEUE_SIZE)),
|
||||
mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
|
||||
mCoroMapping()
|
||||
{
|
||||
|
|
@ -332,7 +332,7 @@ LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
|
|||
mCoroMapping.insert(CoroAdapterMap_t::value_type(pooledCoro, httpAdapter));
|
||||
}
|
||||
|
||||
LL_INFOS("CoProcMgr") << "Created coprocedure pool named \"" << mPoolName << "\" with " << size << " items, queue max " << DEFAULT_QUEUE_SIZE << LL_ENDL;
|
||||
LL_INFOS("CoProcMgr") << "Created coprocedure pool named \"" << mPoolName << "\" with " << size << " items, queue max " << LLCoprocedureManager::DEFAULT_QUEUE_SIZE << LL_ENDL;
|
||||
}
|
||||
|
||||
LLCoprocedurePool::~LLCoprocedurePool()
|
||||
|
|
|
|||
|
|
@ -91,6 +91,9 @@ private:
|
|||
|
||||
SettingQuery_t mPropertyQueryFn;
|
||||
SettingUpdate_t mPropertyDefineFn;
|
||||
|
||||
public:
|
||||
static const U32 DEFAULT_QUEUE_SIZE;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -15147,7 +15147,7 @@
|
|||
<key>Value</key>
|
||||
<real>1</real>
|
||||
</map>
|
||||
<key>PoolSizeVAssetStorage</key>
|
||||
<key>PoolSizeAssetStorage</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Coroutine Pool size for AssetStorage requests</string>
|
||||
|
|
|
|||
|
|
@ -49,8 +49,8 @@
|
|||
/// LLViewerAssetRequest
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
// There is also PoolSizeVAssetStorage value in setting that should mirror this name
|
||||
static const std::string VIEWER_ASSET_STORAGE_CORO_POOL = "VAssetStorage";
|
||||
// There is also PoolSizeAssetStorage value in setting that should mirror this name
|
||||
static const std::string VIEWER_ASSET_STORAGE_CORO_POOL = "AssetStorage";
|
||||
|
||||
/**
|
||||
* @brief Local class to encapsulate asset fetch requests with a timestamp.
|
||||
|
|
@ -137,6 +137,14 @@ LLViewerAssetStorage::~LLViewerAssetStorage()
|
|||
// This class has dedicated coroutine pool, clean it up, otherwise coroutines will crash later.
|
||||
LLCoprocedureManager::instance().close(VIEWER_ASSET_STORAGE_CORO_POOL);
|
||||
}
|
||||
|
||||
while (mCoroWaitList.size() > 0)
|
||||
{
|
||||
CoroWaitList &request = mCoroWaitList.front();
|
||||
// Clean up pending downloads, delete request and trigger callbacks
|
||||
removeAndCallbackPendingDownloads(request.mId, request.mType, request.mId, request.mType, LL_ERR_NOERR, LLExtStat::NONE);
|
||||
mCoroWaitList.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -350,6 +358,27 @@ void LLViewerAssetStorage::storeAssetData(
|
|||
}
|
||||
}
|
||||
|
||||
void LLViewerAssetStorage::checkForTimeouts()
|
||||
{
|
||||
LLAssetStorage::checkForTimeouts();
|
||||
|
||||
// Restore requests
|
||||
LLCoprocedureManager* manager = LLCoprocedureManager::getInstance();
|
||||
while (mCoroWaitList.size() > 0
|
||||
&& manager->count(VIEWER_ASSET_STORAGE_CORO_POOL) < LLCoprocedureManager::DEFAULT_QUEUE_SIZE)
|
||||
{
|
||||
CoroWaitList &request = mCoroWaitList.front();
|
||||
|
||||
bool with_http = true;
|
||||
bool is_temp = false;
|
||||
LLViewerAssetStatsFF::record_enqueue(request.mType, with_http, is_temp);
|
||||
|
||||
manager->enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro",
|
||||
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, request.mRequest, request.mId, request.mType, request.mCallback, request.mUserData));
|
||||
|
||||
mCoroWaitList.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Allocate and queue an asset fetch request for the viewer
|
||||
|
|
@ -407,12 +436,20 @@ void LLViewerAssetStorage::queueRequestHttp(
|
|||
// This is the same as the current UDP logic - don't re-request a duplicate.
|
||||
if (!duplicate)
|
||||
{
|
||||
bool with_http = true;
|
||||
bool is_temp = false;
|
||||
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
|
||||
// Coroutine buffer has fixed size (synchronization buffer, so we have no alternatives), so buffer any request above limit
|
||||
if (LLCoprocedureManager::instance().count(VIEWER_ASSET_STORAGE_CORO_POOL) < LLCoprocedureManager::DEFAULT_QUEUE_SIZE)
|
||||
{
|
||||
bool with_http = true;
|
||||
bool is_temp = false;
|
||||
LLViewerAssetStatsFF::record_enqueue(atype, with_http, is_temp);
|
||||
|
||||
LLCoprocedureManager::instance().enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL,"LLViewerAssetStorage::assetRequestCoro",
|
||||
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
|
||||
LLCoprocedureManager::instance().enqueueCoprocedure(VIEWER_ASSET_STORAGE_CORO_POOL, "LLViewerAssetStorage::assetRequestCoro",
|
||||
boost::bind(&LLViewerAssetStorage::assetRequestCoro, this, req, uuid, atype, callback, user_data));
|
||||
}
|
||||
else
|
||||
{
|
||||
mCoroWaitList.emplace_back(req, uuid, atype, callback, user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
~LLViewerAssetStorage();
|
||||
|
||||
virtual void storeAssetData(
|
||||
void storeAssetData(
|
||||
const LLTransactionID& tid,
|
||||
LLAssetType::EType atype,
|
||||
LLStoreAssetCallback callback,
|
||||
|
|
@ -54,9 +54,9 @@ public:
|
|||
bool is_priority = false,
|
||||
bool store_local = false,
|
||||
bool user_waiting=FALSE,
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
|
||||
|
||||
virtual void storeAssetData(
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
|
||||
|
||||
void storeAssetData(
|
||||
const std::string& filename,
|
||||
const LLTransactionID& tid,
|
||||
LLAssetType::EType type,
|
||||
|
|
@ -65,16 +65,17 @@ public:
|
|||
bool temp_file = false,
|
||||
bool is_priority = false,
|
||||
bool user_waiting=FALSE,
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT);
|
||||
F64Seconds timeout=LL_ASSET_STORAGE_TIMEOUT) override;
|
||||
|
||||
void checkForTimeouts() override;
|
||||
|
||||
protected:
|
||||
// virtual
|
||||
void _queueDataRequest(const LLUUID& uuid,
|
||||
LLAssetType::EType type,
|
||||
LLGetAssetCallback callback,
|
||||
void *user_data,
|
||||
BOOL duplicate,
|
||||
BOOL is_priority);
|
||||
BOOL is_priority) override;
|
||||
|
||||
void queueRequestHttp(const LLUUID& uuid,
|
||||
LLAssetType::EType type,
|
||||
|
|
@ -94,7 +95,34 @@ protected:
|
|||
std::string getAssetURL(const std::string& cap_url, const LLUUID& uuid, LLAssetType::EType atype);
|
||||
|
||||
void logAssetStorageInfo();
|
||||
|
||||
|
||||
// Asset storage works through coroutines and coroutines have limited queue capacity
|
||||
// This class is meant to temporary store requests when fiber's queue is full
|
||||
class CoroWaitList
|
||||
{
|
||||
public:
|
||||
CoroWaitList(LLViewerAssetRequest *req,
|
||||
const LLUUID& uuid,
|
||||
LLAssetType::EType atype,
|
||||
LLGetAssetCallback &callback,
|
||||
void *user_data)
|
||||
: mRequest(req),
|
||||
mId(uuid),
|
||||
mType(atype),
|
||||
mCallback(callback),
|
||||
mUserData(user_data)
|
||||
{
|
||||
}
|
||||
|
||||
LLViewerAssetRequest* mRequest;
|
||||
LLUUID mId;
|
||||
LLAssetType::EType mType;
|
||||
LLGetAssetCallback mCallback;
|
||||
void *mUserData;
|
||||
};
|
||||
typedef std::list<CoroWaitList> wait_list_t;
|
||||
wait_list_t mCoroWaitList;
|
||||
|
||||
std::string mViewerAssetUrl;
|
||||
S32 mAssetCoroCount;
|
||||
S32 mCountRequests;
|
||||
|
|
|
|||
Loading…
Reference in New Issue