Prevent the Viewer's threaded inventory retrieval causing a OOM and overload

the inventory server by serializing upstream requests.
remotes/origin/0.6.7-post-fixes
Melanie 2009-09-02 05:04:24 +01:00
parent f32de6fe88
commit 994c5e2094
1 changed files with 48 additions and 38 deletions

View File

@ -106,6 +106,7 @@ namespace OpenSim.Framework.Capabilities
private Queue<string> m_capsEventQueue = new Queue<string>(); private Queue<string> m_capsEventQueue = new Queue<string>();
private bool m_dumpAssetsToFile; private bool m_dumpAssetsToFile;
private string m_regionName; private string m_regionName;
private object m_fetchLock = new Object();
public bool SSLCaps public bool SSLCaps
{ {
@ -368,15 +369,21 @@ namespace OpenSim.Framework.Capabilities
public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse) public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse)
{ {
// m_log.Debug("[CAPS]: FetchInventoryDescendentsRequest in region: " + m_regionName + "request is "+request); // nasty temporary hack here, the linden client falsely
// identifies the uuid 00000000-0000-0000-0000-000000000000
// nasty temporary hack here, the linden client falsely identifies the uuid 00000000-0000-0000-0000-000000000000 as a string which breaks us // as a string which breaks us
//
// correctly mark it as a uuid // correctly mark it as a uuid
//
request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>"); request = request.Replace("<string>00000000-0000-0000-0000-000000000000</string>", "<uuid>00000000-0000-0000-0000-000000000000</uuid>");
// another hack <integer>1</integer> results in a System.ArgumentException: Object type System.Int32 cannot be converted to target type: System.Boolean // another hack <integer>1</integer> results in a
// System.ArgumentException: Object type System.Int32 cannot
// be converted to target type: System.Boolean
//
request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>0</integer>", "<key>fetch_folders</key><boolean>0</boolean>");
request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>"); request = request.Replace("<key>fetch_folders</key><integer>1</integer>", "<key>fetch_folders</key><boolean>1</boolean>");
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
try try
{ {
@ -391,6 +398,8 @@ namespace OpenSim.Framework.Capabilities
ArrayList foldersrequested = (ArrayList)hash["folders"]; ArrayList foldersrequested = (ArrayList)hash["folders"];
string response = ""; string response = "";
lock (m_fetchLock)
{
for (int i = 0; i < foldersrequested.Count; i++) for (int i = 0; i < foldersrequested.Count; i++)
{ {
string inventoryitemstr = ""; string inventoryitemstr = "";
@ -431,6 +440,7 @@ namespace OpenSim.Framework.Capabilities
//m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml"); //m_log.DebugFormat("[CAPS]: Replying to CAPS fetch inventory request with following xml");
//m_log.Debug("[CAPS] "+response); //m_log.Debug("[CAPS] "+response);
}
return response; return response;
} }