From 5b19d5a7b763a5ff5a7380f00c08fc30f4707588 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Oct 2009 14:05:58 -0700 Subject: Reduced locking. --- OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index facfb9d..2120d33 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -167,8 +167,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP J2KImage imagereq; int numCollected = 0; - lock (m_syncRoot) - { + //lock (m_syncRoot) + //{ m_lastloopprocessed = DateTime.Now.Ticks; // This can happen during Close() @@ -191,7 +191,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (numCollected == count) break; } - } + //} return m_priorityQueue.Count > 0; } @@ -211,16 +211,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP { J2KImage image = null; - if (m_priorityQueue.Count > 0) + lock (m_priorityQueue) { - try + + if (m_priorityQueue.Count > 0) { - lock (m_priorityQueue) + try + { image = m_priorityQueue.FindMax(); + } + catch (Exception) { } } - catch (Exception) { } } - return image; } -- cgit v1.1 From 362e94a0229d0b450001b8b089a472b550b530f3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 4 Oct 2009 16:30:12 -0700 Subject: * KeepAlive set to false in expect_user and log_off. * Check for null SP in PermissionsModule. --- .../CoreModules/World/Permissions/PermissionsModule.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 9622555..901144a 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -397,10 +397,15 @@ namespace OpenSim.Region.CoreModules.World.Permissions // with the powers requested (powers = 0 for no powers check) protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) { - IClientAPI client = m_scene.GetScenePresence(userID).ControllingClient; - - return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && - ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); + ScenePresence sp = m_scene.GetScenePresence(userID); + if (sp != null) + { + IClientAPI client = sp.ControllingClient; + + return ((groupID == client.ActiveGroupId) && (client.ActiveGroupPowers != 0) && + ((powers == 0) || ((client.ActiveGroupPowers & powers) == powers))); + } + return false; } /// -- cgit v1.1 From 5c593f3892d3de0bc3dab25c9298a3f31d3d86c1 Mon Sep 17 00:00:00 2001 From: dahlia Date: Sun, 4 Oct 2009 20:01:44 -0700 Subject: only cache mesh if meshing was successful re-enable sculpt mesh caching --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 0e29ccc..1ea08e2 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -498,12 +498,9 @@ namespace OpenSim.Region.Physics.Meshing // If this mesh has been created already, return it instead of creating another copy // For large regions with 100k+ prims and hundreds of copies of each, this can save a GB or more of memory - if (! primShape.SculptEntry) - { - key = GetMeshKey(primShape, size, lod); - if (m_uniqueMeshes.TryGetValue(key, out mesh)) - return mesh; - } + key = GetMeshKey(primShape, size, lod); + if (m_uniqueMeshes.TryGetValue(key, out mesh)) + return mesh; if (size.X < 0.01f) size.X = 0.01f; if (size.Y < 0.01f) size.Y = 0.01f; @@ -525,10 +522,9 @@ namespace OpenSim.Region.Physics.Meshing // trim the vertex and triangle lists to free up memory mesh.TrimExcess(); - } - if (!primShape.SculptEntry) m_uniqueMeshes.Add(key, mesh); + } return mesh; } -- cgit v1.1 From 6d52974c5f8184c03e3366fdcce03e4ec15c85f6 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Mon, 5 Oct 2009 05:35:56 -0700 Subject: Eliminate pinned Mesh data on managed heap by using IntPtrs to memory allocated on the unmanaged heap. This prevents fragmentation of the managed heap and the resulting stress on GC. A region with ~150,000 prims using ODE and Meshmerizer saw memory remain flat around 1.2GB as opposed to 1.5GB and continually growing due to pinned memory. This patch complements the unique mesh dictionary patch applied to Meshmerizer but is independent. The net effect is a 60-75% reduction in memory for our largest regions. --- OpenSim/Region/Physics/Manager/IMesher.cs | 2 + OpenSim/Region/Physics/Meshing/Mesh.cs | 166 +++++++++++++++++++--------- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 13 +-- 3 files changed, 120 insertions(+), 61 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index e26c623..ac14292 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs @@ -47,6 +47,8 @@ namespace OpenSim.Region.Physics.Manager int[] getIndexListAsInt(); int[] getIndexListAsIntLocked(); float[] getVertexListAsFloatLocked(); + void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount); + void getVertexListAsPtrToFloatArray( out IntPtr vertexList, out int vertexStride, out int vertexCount ); void releaseSourceMeshData(); void releasePinned(); void Append(IMesh newMesh); diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs index aae8871..ff1f816 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/Physics/Meshing/Mesh.cs @@ -36,23 +36,27 @@ namespace OpenSim.Region.Physics.Meshing { public class Mesh : IMesh { - private Dictionary vertices; - private List triangles; - GCHandle pinnedVirtexes; - GCHandle pinnedIndex; - public float[] normals; + private Dictionary m_vertices; + private List m_triangles; + GCHandle m_pinnedVertexes; + GCHandle m_pinnedIndex; + IntPtr m_verticesPtr = IntPtr.Zero; + int m_vertexCount = 0; + IntPtr m_indicesPtr = IntPtr.Zero; + int m_indexCount = 0; + public float[] m_normals; public Mesh() { - vertices = new Dictionary(); - triangles = new List(); + m_vertices = new Dictionary(); + m_triangles = new List(); } public Mesh Clone() { Mesh result = new Mesh(); - foreach (Triangle t in triangles) + foreach (Triangle t in m_triangles) { result.Add(new Triangle(t.v1.Clone(), t.v2.Clone(), t.v3.Clone())); } @@ -62,27 +66,27 @@ namespace OpenSim.Region.Physics.Meshing public void Add(Triangle triangle) { - if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) + if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) throw new NotSupportedException("Attempt to Add to a pinned Mesh"); // If a vertex of the triangle is not yet in the vertices list, // add it and set its index to the current index count - if (!vertices.ContainsKey(triangle.v1)) - vertices[triangle.v1] = vertices.Count; - if (!vertices.ContainsKey(triangle.v2)) - vertices[triangle.v2] = vertices.Count; - if (!vertices.ContainsKey(triangle.v3)) - vertices[triangle.v3] = vertices.Count; - triangles.Add(triangle); + if( !m_vertices.ContainsKey(triangle.v1) ) + m_vertices[triangle.v1] = m_vertices.Count; + if (!m_vertices.ContainsKey(triangle.v2)) + m_vertices[triangle.v2] = m_vertices.Count; + if (!m_vertices.ContainsKey(triangle.v3)) + m_vertices[triangle.v3] = m_vertices.Count; + m_triangles.Add(triangle); } public void CalcNormals() { - int iTriangles = triangles.Count; + int iTriangles = m_triangles.Count; - this.normals = new float[iTriangles * 3]; + this.m_normals = new float[iTriangles * 3]; int i = 0; - foreach (Triangle t in triangles) + foreach (Triangle t in m_triangles) { float ux, uy, uz; float vx, vy, vz; @@ -129,9 +133,9 @@ namespace OpenSim.Region.Physics.Meshing //ny /= l; //nz /= l; - normals[i] = nx * lReciprocal; - normals[i + 1] = ny * lReciprocal; - normals[i + 2] = nz * lReciprocal; + m_normals[i] = nx * lReciprocal; + m_normals[i + 1] = ny * lReciprocal; + m_normals[i + 2] = nz * lReciprocal; i += 3; } @@ -140,45 +144,70 @@ namespace OpenSim.Region.Physics.Meshing public List getVertexList() { List result = new List(); - foreach (Vertex v in vertices.Keys) + foreach (Vertex v in m_vertices.Keys) { result.Add(v); } return result; } - public float[] getVertexListAsFloatLocked() + private float[] getVertexListAsFloat() { - if (pinnedVirtexes.IsAllocated) - return (float[])(pinnedVirtexes.Target); - float[] result; - - //m_log.WarnFormat("vertices.Count = {0}", vertices.Count); - result = new float[vertices.Count * 3]; - foreach (KeyValuePair kvp in vertices) + if(m_vertices == null) + throw new NotSupportedException(); + float[] result = new float[m_vertices.Count * 3]; + foreach (KeyValuePair kvp in m_vertices) { Vertex v = kvp.Key; int i = kvp.Value; - //m_log.WarnFormat("kvp.Value = {0}", i); result[3 * i + 0] = v.X; result[3 * i + 1] = v.Y; result[3 * i + 2] = v.Z; } - pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned); return result; } - public int[] getIndexListAsInt() + public float[] getVertexListAsFloatLocked() { - int[] result; + if( m_pinnedVertexes.IsAllocated ) + return (float[])(m_pinnedVertexes.Target); - result = new int[triangles.Count * 3]; - for (int i = 0; i < triangles.Count; i++) + float[] result = getVertexListAsFloat(); + m_pinnedVertexes = GCHandle.Alloc(result, GCHandleType.Pinned); + + return result; + } + + public void getVertexListAsPtrToFloatArray(out IntPtr vertices, out int vertexStride, out int vertexCount) + { + // A vertex is 3 floats + vertexStride = 3 * sizeof(float); + + // If there isn't an unmanaged array allocated yet, do it now + if (m_verticesPtr == IntPtr.Zero) { - Triangle t = triangles[i]; - result[3 * i + 0] = vertices[t.v1]; - result[3 * i + 1] = vertices[t.v2]; - result[3 * i + 2] = vertices[t.v3]; + float[] vertexList = getVertexListAsFloat(); + // Each vertex is 3 elements (floats) + m_vertexCount = vertexList.Length / 3; + int byteCount = m_vertexCount * vertexStride; + m_verticesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount); + System.Runtime.InteropServices.Marshal.Copy(vertexList, 0, m_verticesPtr, m_vertexCount * 3); + } + vertices = m_verticesPtr; + vertexCount = m_vertexCount; + } + + public int[] getIndexListAsInt() + { + if (m_triangles == null) + throw new NotSupportedException(); + int[] result = new int[m_triangles.Count * 3]; + for (int i = 0; i < m_triangles.Count; i++) + { + Triangle t = m_triangles[i]; + result[3 * i + 0] = m_vertices[t.v1]; + result[3 * i + 1] = m_vertices[t.v2]; + result[3 * i + 2] = m_vertices[t.v3]; } return result; } @@ -189,19 +218,48 @@ namespace OpenSim.Region.Physics.Meshing /// public int[] getIndexListAsIntLocked() { - if (pinnedIndex.IsAllocated) - return (int[])(pinnedIndex.Target); + if (m_pinnedIndex.IsAllocated) + return (int[])(m_pinnedIndex.Target); int[] result = getIndexListAsInt(); - pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); + m_pinnedIndex = GCHandle.Alloc(result, GCHandleType.Pinned); return result; } + public void getIndexListAsPtrToIntArray(out IntPtr indices, out int triStride, out int indexCount) + { + // If there isn't an unmanaged array allocated yet, do it now + if (m_indicesPtr == IntPtr.Zero) + { + int[] indexList = getIndexListAsInt(); + m_indexCount = indexList.Length; + int byteCount = m_indexCount * sizeof(int); + m_indicesPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(byteCount); + System.Runtime.InteropServices.Marshal.Copy(indexList, 0, m_indicesPtr, m_indexCount); + } + // A triangle is 3 ints (indices) + triStride = 3 * sizeof(int); + indices = m_indicesPtr; + indexCount = m_indexCount; + } + public void releasePinned() { - pinnedVirtexes.Free(); - pinnedIndex.Free(); + if (m_pinnedVertexes.IsAllocated) + m_pinnedVertexes.Free(); + if (m_pinnedIndex.IsAllocated) + m_pinnedIndex.Free(); + if (m_verticesPtr != IntPtr.Zero) + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(m_verticesPtr); + m_verticesPtr = IntPtr.Zero; + } + if (m_indicesPtr != IntPtr.Zero) + { + System.Runtime.InteropServices.Marshal.FreeHGlobal(m_indicesPtr); + m_indicesPtr = IntPtr.Zero; + } } /// @@ -209,29 +267,29 @@ namespace OpenSim.Region.Physics.Meshing /// public void releaseSourceMeshData() { - triangles = null; - vertices = null; + m_triangles = null; + m_vertices = null; } public void Append(IMesh newMesh) { - if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) + if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) throw new NotSupportedException("Attempt to Append to a pinned Mesh"); if (!(newMesh is Mesh)) return; - foreach (Triangle t in ((Mesh)newMesh).triangles) + foreach (Triangle t in ((Mesh)newMesh).m_triangles) Add(t); } // Do a linear transformation of mesh. public void TransformLinear(float[,] matrix, float[] offset) { - if (pinnedIndex.IsAllocated || pinnedVirtexes.IsAllocated) + if (m_pinnedIndex.IsAllocated || m_pinnedVertexes.IsAllocated || m_indicesPtr != IntPtr.Zero || m_verticesPtr != IntPtr.Zero) throw new NotSupportedException("Attempt to TransformLinear a pinned Mesh"); - foreach (Vertex v in vertices.Keys) + foreach (Vertex v in m_vertices.Keys) { if (v == null) continue; @@ -252,7 +310,7 @@ namespace OpenSim.Region.Physics.Meshing String fileName = name + "_" + title + ".raw"; String completePath = Path.Combine(path, fileName); StreamWriter sw = new StreamWriter(completePath); - foreach (Triangle t in triangles) + foreach (Triangle t in m_triangles) { String s = t.ToStringRaw(); sw.WriteLine(s); @@ -262,7 +320,7 @@ namespace OpenSim.Region.Physics.Meshing public void TrimExcess() { - triangles.TrimExcess(); + m_triangles.TrimExcess(); } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 032b5df..c041243 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -813,18 +813,17 @@ namespace OpenSim.Region.Physics.OdePlugin } } - float[] vertexList = mesh.getVertexListAsFloatLocked(); // Note, that vertextList is pinned in memory - int[] indexList = mesh.getIndexListAsIntLocked(); // Also pinned, needs release after usage + IntPtr vertices, indices; + int vertexCount, indexCount; + int vertexStride, triStride; + mesh.getVertexListAsPtrToFloatArray( out vertices, out vertexStride, out vertexCount ); // Note, that vertices are fixed in unmanaged heap + mesh.getIndexListAsPtrToIntArray( out indices, out triStride, out indexCount ); // Also fixed, needs release after usage mesh.releaseSourceMeshData(); // free up the original mesh data to save memory - int VertexCount = vertexList.GetLength(0)/3; - int IndexCount = indexList.GetLength(0); - _triMeshData = d.GeomTriMeshDataCreate(); - d.GeomTriMeshDataBuildSimple(_triMeshData, vertexList, 3*sizeof (float), VertexCount, indexList, IndexCount, - 3*sizeof (int)); + d.GeomTriMeshDataBuildSimple(_triMeshData, vertices, vertexStride, vertexCount, indices, indexCount, triStride); d.GeomTriMeshDataPreprocess(_triMeshData); _parent_scene.waitForSpaceUnlock(m_targetSpace); -- cgit v1.1 From ad81b453b38b538d5b4c40a326decee2577e024e Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Oct 2009 09:02:52 -0700 Subject: GetRegionByPosition: use the cache, Luke. --- .../ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs | 14 ++++++++++++++ .../CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs | 14 ++++++++++++++ 2 files changed, 28 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs index 3ca4882..1c72488 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/LocalGridServiceConnector.cs @@ -206,6 +206,20 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { + GridRegion region = null; + + // First see if it's a neighbour, even if it isn't on this sim. + // Neighbour data is cached in memory, so this is fast + foreach (RegionCache rcache in m_LocalCache.Values) + { + region = rcache.GetRegionByPosition(x, y); + if (region != null) + { + return region; + } + } + + // Then try on this sim (may be a lookup in DB if this is using MySql). return m_GridService.GetRegionByPosition(scopeID, x, y); } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs index 2b336bb..44e850b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionCache.cs @@ -29,10 +29,12 @@ using System; using System.Collections.Generic; using System.Reflection; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; using GridRegion = OpenSim.Services.Interfaces.GridRegion; +using OpenMetaverse; using log4net; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid @@ -75,5 +77,17 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { return new List(m_neighbours.Values); } + + public GridRegion GetRegionByPosition(int x, int y) + { + uint xsnap = (uint)(x / Constants.RegionSize) * Constants.RegionSize; + uint ysnap = (uint)(y / Constants.RegionSize) * Constants.RegionSize; + ulong handle = Utils.UIntsToLong(xsnap, ysnap); + + if (m_neighbours.ContainsKey(handle)) + return m_neighbours[handle]; + + return null; + } } } -- cgit v1.1 From 10c4b88ccfb02c84faeeb805226614aeffdebb71 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 5 Oct 2009 18:20:37 +0100 Subject: minor: remove mono compile warning --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 0769c90..f5ab1de 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -3476,7 +3476,7 @@ namespace OpenSim.Region.Physics.OdePlugin public override void UnCombine(PhysicsScene pScene) { IntPtr localGround = IntPtr.Zero; - float[] localHeightfield; + //float[] localHeightfield; bool proceed = false; List geomDestroyList = new List(); @@ -3771,16 +3771,13 @@ namespace OpenSim.Region.Physics.OdePlugin sides.Z = 0.5f; ds.DrawBox(ref pos, ref R, ref sides); - - } } } } public void start(int unused) - { - + { ds.SetViewpoint(ref xyz, ref hpr); } #endif -- cgit v1.1 From 2a19187e0195080a0d6894e31f383025af824232 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 5 Oct 2009 18:32:19 +0100 Subject: * minor: tweak asset cache logging levels downwards --- OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs | 12 ++++++------ OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs | 2 +- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 5 +---- OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs index 5a5ad7e..66ca7c2 100644 --- a/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CenomeAssetCache.cs @@ -178,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Asset { if (maximalSize <= 0 || maximalCount <= 0) { - Log.Info("[ASSET CACHE]: Cenome asset cache is not enabled."); + //Log.Debug("[ASSET CACHE]: Cenome asset cache is not enabled."); m_enabled = false; return; } @@ -194,7 +194,7 @@ namespace OpenSim.Region.CoreModules.Asset CnmSynchronizedCache.Synchronized(new CnmMemoryCache( maximalSize, maximalCount, expirationTime)); m_enabled = true; - Log.InfoFormat( + Log.DebugFormat( "[ASSET CACHE]: Cenome asset cache enabled (MaxSize = {0} bytes, MaxCount = {1}, ExpirationTime = {2})", maximalSize, maximalCount, @@ -263,7 +263,7 @@ namespace OpenSim.Region.CoreModules.Asset if (m_getCount == m_debugEpoch) { - Log.InfoFormat( + Log.DebugFormat( "[ASSET CACHE]: Cached = {0}, Get = {1}, Hits = {2}%, Size = {3} bytes, Avg. A. Size = {4} bytes", m_cachedCount, m_getCount, @@ -333,7 +333,7 @@ namespace OpenSim.Region.CoreModules.Asset return; string name = moduleConfig.GetString("AssetCaching"); - Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); + //Log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); if (name != Name) return; @@ -343,14 +343,14 @@ namespace OpenSim.Region.CoreModules.Asset int maxCount = DefaultMaxCount; TimeSpan expirationTime = DefaultExpirationTime; - IConfig assetConfig = source.Configs[ "AssetCache" ]; + IConfig assetConfig = source.Configs["AssetCache"]; if (assetConfig != null) { // Get optional configurations maxSize = assetConfig.GetLong("MaxSize", DefaultMaxSize); maxCount = assetConfig.GetInt("MaxCount", DefaultMaxCount); expirationTime = - TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int) DefaultExpirationTime.TotalMinutes)); + TimeSpan.FromMinutes(assetConfig.GetInt("ExpirationTime", (int)DefaultExpirationTime.TotalMinutes)); // Debugging purposes only m_debugEpoch = assetConfig.GetInt("DebugEpoch", 0); diff --git a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs index 2de40d2..0a7e736 100644 --- a/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/CoreAssetCache.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.Asset if (moduleConfig != null) { string name = moduleConfig.GetString("AssetCaching"); - m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); + //m_log.DebugFormat("[XXX] name = {0} (this module's name: {1}", name, Name); if (name == Name) { diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index c0bb70c..b81ab41 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -636,11 +636,8 @@ namespace Flotsam.RegionModules.AssetCache m_log.InfoFormat("[FLOTSAM ASSET CACHE] flotsamcache clearfile - Remove all assets cached on disk"); } - - } #endregion - } -} +} \ No newline at end of file diff --git a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs index 8d8e0fe..4869f5d 100644 --- a/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/GlynnTuckerAssetCache.cs @@ -68,7 +68,7 @@ namespace OpenSim.Region.CoreModules.Asset if (moduleConfig != null) { string name = moduleConfig.GetString("AssetCaching"); - m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized); + //m_log.DebugFormat("[ASSET CACHE] name = {0} (this module's name: {1}). Sync? ", name, Name, m_Cache.IsSynchronized); if (name == Name) { -- cgit v1.1 From 05c1ec7fafe581e368d57138b2d1df7e590c2dd5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 5 Oct 2009 11:01:45 -0700 Subject: Changed the lock object, to see if this helps at all. Also switched the order of lock and try/catch in RemoveImageFromQueue. --- .../Region/ClientStack/LindenUDP/LLImageManager.cs | 26 +++++++++++++--------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs index 2120d33..cc290ed 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLImageManager.cs @@ -88,7 +88,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP J2KImage imgrequest; // Do a linear search for this texture download - lock (m_priorityQueue) + lock (m_syncRoot) m_priorityQueue.Find(delegate(J2KImage img) { return img.TextureID == newRequest.RequestedAssetID; }, out imgrequest); if (imgrequest != null) @@ -99,7 +99,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP try { - lock (m_priorityQueue) + lock (m_syncRoot) m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); } catch (Exception) { } @@ -211,7 +211,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP { J2KImage image = null; - lock (m_priorityQueue) + lock (m_syncRoot) { if (m_priorityQueue.Count > 0) @@ -230,23 +230,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP { image.PriorityQueueHandle = null; - lock (m_priorityQueue) - m_priorityQueue.Add(ref image.PriorityQueueHandle, image); + lock (m_syncRoot) + try + { + m_priorityQueue.Add(ref image.PriorityQueueHandle, image); + } + catch (Exception) { } } void RemoveImageFromQueue(J2KImage image) { - try - { - lock (m_priorityQueue) + lock (m_syncRoot) + try + { m_priorityQueue.Delete(image.PriorityQueueHandle); - } - catch (Exception) { } + } + catch (Exception) { } } void UpdateImageInQueue(J2KImage image) { - lock (m_priorityQueue) + lock (m_syncRoot) { try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } catch (Exception) -- cgit v1.1 From 544675d0f0969ce19ca41d3e70b0b0d5c853210a Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Mon, 5 Oct 2009 11:59:33 -0700 Subject: Ensure the specified imSessionID exists in the DroppedSession collection before attempting to access it. --- .../Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs index 631d801..00fe5df 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsMessagingModule.cs @@ -425,7 +425,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (GroupMembersData member in m_groupsModule.GroupMembersRequest(null, groupID)) { - if (m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) + if (!m_agentsDroppedSession.ContainsKey(im.imSessionID) || m_agentsDroppedSession[im.imSessionID].Contains(member.AgentID.Guid)) { // Don't deliver messages to people who have dropped this session if (m_debugEnabled) m_log.DebugFormat("[GROUPS-MESSAGING]: {0} has dropped session, not delivering to them", member.AgentID); -- cgit v1.1 From d4a6d9191a3ba4f19773213617843ddbb489c90c Mon Sep 17 00:00:00 2001 From: Michael Cortez Date: Mon, 5 Oct 2009 12:09:45 -0700 Subject: Make sure that keys exist in arrays before trying to access them. --- .../OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 2e89a24..b209199 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -148,9 +148,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups UUID[] CurrentKeys = new UUID[m_clientRequestIDInfo.Count]; foreach (UUID key in CurrentKeys) { - if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout) + if (m_clientRequestIDInfo.ContainsKey(key)) { - m_clientRequestIDInfo.Remove(key); + if (DateTime.Now - m_clientRequestIDInfo[key].LastUsedTMStamp > cacheTimeout) + { + m_clientRequestIDInfo.Remove(key); + } } } } @@ -476,7 +479,10 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups foreach (string key in binBucketOSD.Keys) { - m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); + if (binBucketOSD.ContainsKey(key)) + { + m_log.WarnFormat("{0}: {1}", key, binBucketOSD[key].ToString()); + } } } -- cgit v1.1