another attempt at fixing asset lockups

0.6.0-stable
MW 2008-02-27 16:20:45 +00:00
parent f218e7e090
commit aac7c1dda5
1 changed files with 250 additions and 227 deletions

View File

@ -265,6 +265,7 @@ namespace OpenSim.Framework.Communications.Cache
AssetRequestsList requestList; AssetRequestsList requestList;
lock (RequestLists) lock (RequestLists)
{ {
// m_log.Info("AssetCache: Lock taken on requestLists (GetAsset)");
if (RequestLists.TryGetValue(assetId, out requestList)) if (RequestLists.TryGetValue(assetId, out requestList))
{ {
} }
@ -274,6 +275,7 @@ namespace OpenSim.Framework.Communications.Cache
RequestLists.Add(assetId, requestList); RequestLists.Add(assetId, requestList);
} }
} }
// m_log.Info("AssetCache: Lock released on requestLists (GetAsset)");
requestList.Requests.Add(req); requestList.Requests.Add(req);
@ -469,9 +471,11 @@ namespace OpenSim.Framework.Communications.Cache
AssetRequestsList reqList = null; AssetRequestsList reqList = null;
lock (RequestLists) lock (RequestLists)
{ {
//m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #1)");
reqList = RequestLists[asset.FullID]; reqList = RequestLists[asset.FullID];
} }
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #1)");
if (reqList != null) if (reqList != null)
{ {
//making a copy of the list is not ideal //making a copy of the list is not ideal
@ -486,8 +490,10 @@ namespace OpenSim.Framework.Communications.Cache
lock (RequestLists) lock (RequestLists)
{ {
// m_log.Info("AssetCache: Lock taken on requestLists (AssetReceived #2)");
RequestLists.Remove(asset.FullID); RequestLists.Remove(asset.FullID);
} }
//m_log.Info("AssetCache: Lock released on requestLists (AssetReceived #2)");
foreach (NewAssetRequest req in theseRequests) foreach (NewAssetRequest req in theseRequests)
{ {
@ -501,22 +507,38 @@ namespace OpenSim.Framework.Communications.Cache
// See IAssetReceiver // See IAssetReceiver
public void AssetNotFound(LLUUID assetID) public void AssetNotFound(LLUUID assetID)
{ {
m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID); // m_log.WarnFormat("[ASSET CACHE]: AssetNotFound for {0}", assetID);
// Notify requesters for this asset // Notify requesters for this asset
AssetRequestsList reqList = null;
lock (RequestLists) lock (RequestLists)
{ {
// m_log.Info("AssetCache: Lock taken on requestLists (AssetNotFound #1)");
if (RequestLists.ContainsKey(assetID)) if (RequestLists.ContainsKey(assetID))
{ {
AssetRequestsList reqList = RequestLists[assetID]; reqList = RequestLists[assetID];
foreach (NewAssetRequest req in reqList.Requests) }
}
// m_log.Info("AssetCache: Lock released on requestLists (AssetNotFound #1)");
if (reqList != null)
{
List<NewAssetRequest> theseRequests = new List<NewAssetRequest>(reqList.Requests);
reqList.Requests.Clear();
lock (RequestLists)
{
// m_log.Info("AssetCache: Lock taken on requestLists (AssetNotFound #2)");
RequestLists.Remove(assetID);
}
// m_log.Info("AssetCache: Lock released on requestLists (AssetNotFound #2)");
foreach (NewAssetRequest req in theseRequests)
{ {
req.Callback(assetID, null); req.Callback(assetID, null);
} }
}
RequestLists.Remove(assetID);
}
}
} }
/// <summary> /// <summary>
@ -713,6 +735,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
public class AssetInfo : AssetBase public class AssetInfo : AssetBase
{ {
public AssetInfo() public AssetInfo()