From f082de03ff24ae8cc6a2de103bc643c392135742 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Jan 2012 16:36:56 -0700 Subject: fix for SH-2845, SH-2846, SH-2847, SH-2851: curl crashes and out-of-memory crashes. --- indra/llmessage/llcurl.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'indra/llmessage/llcurl.h') diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 9c2c215c7a..32da911cbf 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -43,6 +43,7 @@ #include "llsd.h" #include "llthread.h" #include "llqueuedthread.h" +#include "llframetimer.h" class LLMutex; class LLCurlThread; @@ -182,11 +183,20 @@ public: static unsigned long ssl_thread_id(void); static LLCurlThread* getCurlThread() { return sCurlThread ;} + + static CURLM* newMultiHandle() ; + static CURLMcode deleteMultiHandle(CURLM* handle) ; + static CURL* newEasyHandle() ; + static void deleteEasyHandle(CURL* handle) ; + private: static std::string sCAPath; static std::string sCAFile; static const unsigned int MAX_REDIRECTS; static LLCurlThread* sCurlThread; + + static LLMutex* sHandleMutexp ; + static S32 sTotalHandles ; }; class LLCurl::Easy @@ -277,7 +287,7 @@ public: STATE_COMPLETED=2 } ePerformState; - Multi(); + Multi(F32 idle_time_out = 0.f); LLCurl::Easy* allocEasy(); bool addEasy(LLCurl::Easy* easy); @@ -288,7 +298,10 @@ public: void setState(ePerformState state) ; ePerformState getState() ; + bool isCompleted() ; + bool isValid() {return mCurlMultiHandle != NULL ;} + bool isDead() {return mDead;} bool waitToComplete() ; @@ -299,9 +312,9 @@ public: S32 mQueued; S32 mErrorCount; - static CURLM* initMulti() ; private: void easyFree(LLCurl::Easy*); + void cleanup() ; CURLM* mCurlMultiHandle; @@ -319,8 +332,8 @@ private: LLMutex* mMutexp ; LLMutex* mDeletionMutexp ; LLMutex* mEasyMutexp ; - - static LLMutex* sMultiInitMutexp ; + LLFrameTimer mIdleTimer ; + F32 mIdleTimeOut; }; class LLCurlThread : public LLQueuedThread @@ -414,6 +427,7 @@ public: std::string getErrorString(); bool isCompleted() {return mMulti->isCompleted() ;} bool wait() { return mMulti->waitToComplete(); } + bool isValid() {return mMulti && mMulti->isValid(); } LLCurl::Easy* getEasy() const { return mEasy; } -- cgit v1.2.3 From 11bd5cb86025376a198e45330116de4757b5c89e Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Thu, 12 Jan 2012 20:32:32 -0700 Subject: trivial: fix a mac build error. --- indra/llmessage/llcurl.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llmessage/llcurl.h') diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 32da911cbf..2b23ac9763 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -370,6 +370,7 @@ public: private: bool doMultiPerform(LLCurl::Multi* multi) ; void deleteMulti(LLCurl::Multi* multi) ; + void cleanupMulti(LLCurl::Multi* multi) ; } ; namespace boost -- cgit v1.2.3 From 1316f3313066beef74729c2be5a8d142d185161d Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Jan 2012 16:01:56 -0700 Subject: fix for SH-2904: textures remain stuck in HTP state --- indra/llmessage/llcurl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llmessage/llcurl.h') diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 2b23ac9763..7d2340a6cb 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -197,6 +197,8 @@ private: static LLMutex* sHandleMutexp ; static S32 sTotalHandles ; +public: + static bool sNotQuitting; }; class LLCurl::Easy -- cgit v1.2.3 From 717a6f3306d9382ea252c3e0f243b785c9cae15a Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Wed, 25 Jan 2012 18:27:40 -0700 Subject: Introduce two new parameters "CurlUseMultipleThreads" and "CurlRequestTimeOut" for QA to test Curl. --- indra/llmessage/llcurl.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llmessage/llcurl.h') diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h index 7d2340a6cb..fd664c0fa1 100644 --- a/indra/llmessage/llcurl.h +++ b/indra/llmessage/llcurl.h @@ -163,7 +163,7 @@ public: /** * @ brief Initialize LLCurl class */ - static void initClass(bool multi_threaded = false); + static void initClass(F32 curl_reuest_timeout = 120.f, S32 max_number_handles = 256, bool multi_threaded = false); /** * @ brief Cleanup LLCurl class @@ -197,8 +197,10 @@ private: static LLMutex* sHandleMutexp ; static S32 sTotalHandles ; + static S32 sMaxHandles; public: static bool sNotQuitting; + static F32 sCurlRequestTimeOut; }; class LLCurl::Easy -- cgit v1.2.3