Skip to content
Snippets Groups Projects
Commit 2f52a37e authored by Andrey Kleshchev's avatar Andrey Kleshchev
Browse files

SL-13811 Crash on coroprocedure

parent a8b5ca77
No related branches found
No related tags found
No related merge requests found
......@@ -77,12 +77,12 @@ class LLCoprocedurePool: private boost::noncopyable
///
inline size_t countActive() const
{
return mActiveCoprocs.size();
return mActiveCoprocsCount;
}
/// Returns the total number of coprocedures either queued or in active processing.
///
inline size_t count() const
inline S32 count() const
{
return countPending() + countActive();
}
......@@ -113,12 +113,10 @@ class LLCoprocedurePool: private boost::noncopyable
// because the consuming coroutine might outlive this LLCoprocedurePool
// instance.
typedef boost::shared_ptr<CoprocQueue_t> CoprocQueuePtr;
typedef std::map<LLUUID, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t> ActiveCoproc_t;
std::string mPoolName;
size_t mPoolSize, mPending{0};
size_t mPoolSize, mActiveCoprocsCount, mPending;
CoprocQueuePtr mPendingCoprocs;
ActiveCoproc_t mActiveCoprocs;
LLTempBoundListener mStatusListener;
typedef std::map<std::string, LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t> CoroAdapterMap_t;
......@@ -281,6 +279,8 @@ void LLCoprocedureManager::close(const std::string &pool)
LLCoprocedurePool::LLCoprocedurePool(const std::string &poolName, size_t size):
mPoolName(poolName),
mPoolSize(size),
mActiveCoprocsCount(0),
mPending(0),
mPendingCoprocs(boost::make_shared<CoprocQueue_t>(DEFAULT_QUEUE_SIZE)),
mHTTPPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID),
mCoroMapping()
......@@ -406,8 +406,7 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
}
// we actually popped an item
--mPending;
ActiveCoproc_t::iterator itActive = mActiveCoprocs.insert(ActiveCoproc_t::value_type(coproc->mId, httpAdapter)).first;
mActiveCoprocsCount++;
LL_DEBUGS("CoProcMgr") << "Dequeued and invoking coprocedure(" << coproc->mName << ") with id=" << coproc->mId.asString() << " in pool \"" << mPoolName << "\" (" << mPending << " left)" << LL_ENDL;
......@@ -417,10 +416,6 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
}
catch (const LLCoros::Stop &)
{
LL_INFOS("CoProcMgr") << "Viewer is shutting Down. Stopping coprocedure('" << coproc->mName
<< "', id=" << coproc->mId.asString()
<< ") in pool '" << mPoolName << "'" << LL_ENDL;
mActiveCoprocs.erase(itActive);
throw; // let toplevel handle this as LLContinueError
}
catch (...)
......@@ -429,13 +424,13 @@ void LLCoprocedurePool::coprocedureInvokerCoro(
<< "', id=" << coproc->mId.asString()
<< ") in pool '" << mPoolName << "'"));
// must NOT omit this or we deplete the pool
mActiveCoprocs.erase(itActive);
mActiveCoprocsCount--;
continue;
}
LL_DEBUGS("CoProcMgr") << "Finished coprocedure(" << coproc->mName << ")" << " in pool \"" << mPoolName << "\"" << LL_ENDL;
mActiveCoprocs.erase(itActive);
mActiveCoprocsCount--;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment