From b33db917f59ecfcab96a2aec45e19987dbcb44a2 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 11 Jun 2013 15:36:27 -0700 Subject: Really bad idea to lock m_UserCache for so long in UserManagementModule. Added a special lock object instead, if we really want to avoid concurrent executions of that code. --- .../UserManagement/UserManagementModule.cs | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 1e70b84..ac21b53 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -56,6 +56,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement // The cache protected Dictionary m_UserCache = new Dictionary(); + private object m_AddUserLock = new object(); #region ISharedRegionModule @@ -475,9 +476,11 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData oldUser; //lock the whole block - prevent concurrent update - lock (m_UserCache) + lock (m_AddUserLock) { - m_UserCache.TryGetValue (id, out oldUser); + lock (m_UserCache) + m_UserCache.TryGetValue(id, out oldUser); + if (oldUser != null) { if (creatorData == null || creatorData == String.Empty) @@ -488,9 +491,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement //try update unknown users //and creator's home URL's - if ((oldUser.FirstName == "Unknown" && !creatorData.Contains ("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith (oldUser.HomeURL))) + if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL))) { - m_UserCache.Remove (id); + lock (m_UserCache) + m_UserCache.Remove(id); m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL); } else @@ -500,38 +504,38 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } } - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount (m_Scenes [0].RegionInfo.ScopeID, id); + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); if (account != null) { - AddUser (id, account.FirstName, account.LastName); + AddUser(id, account.FirstName, account.LastName); } else { - UserData user = new UserData (); + UserData user = new UserData(); user.Id = id; if (creatorData != null && creatorData != string.Empty) { //creatorData = ; - string[] parts = creatorData.Split (';'); + string[] parts = creatorData.Split(';'); if (parts.Length >= 1) { - user.HomeURL = parts [0]; + user.HomeURL = parts[0]; try { - Uri uri = new Uri (parts [0]); + Uri uri = new Uri(parts[0]); user.LastName = "@" + uri.Authority; } catch (UriFormatException) { - m_log.DebugFormat ("[SCENE]: Unable to parse Uri {0}", parts [0]); + m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); user.LastName = "@unknown"; } } if (parts.Length >= 2) - user.FirstName = parts [1].Replace (' ', '.'); + user.FirstName = parts[1].Replace(' ', '.'); } else { @@ -539,7 +543,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement user.LastName = "UserUMMAU"; } - AddUserInternal (user); + AddUserInternal(user); } } } -- cgit v1.1 From d8da83b4ff924587c14c888c2a992c56b9b76c80 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 11 Jun 2013 15:50:12 -0700 Subject: Removed the lock entirely --- .../UserManagement/UserManagementModule.cs | 108 ++++++++++----------- 1 file changed, 52 insertions(+), 56 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index ac21b53..864e181 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -56,7 +56,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement // The cache protected Dictionary m_UserCache = new Dictionary(); - private object m_AddUserLock = new object(); #region ISharedRegionModule @@ -476,75 +475,72 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData oldUser; //lock the whole block - prevent concurrent update - lock (m_AddUserLock) - { - lock (m_UserCache) - m_UserCache.TryGetValue(id, out oldUser); + lock (m_UserCache) + m_UserCache.TryGetValue(id, out oldUser); - if (oldUser != null) + if (oldUser != null) + { + if (creatorData == null || creatorData == String.Empty) { - if (creatorData == null || creatorData == String.Empty) - { - //ignore updates without creator data - return; - } - - //try update unknown users - //and creator's home URL's - if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL))) - { - lock (m_UserCache) - m_UserCache.Remove(id); - m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL); - } - else - { - //we have already a valid user within the cache - return; - } + //ignore updates without creator data + return; } - UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); - - if (account != null) + //try update unknown users + //and creator's home URL's + if ((oldUser.FirstName == "Unknown" && !creatorData.Contains("Unknown")) || (oldUser.HomeURL != null && !creatorData.StartsWith(oldUser.HomeURL))) { - AddUser(id, account.FirstName, account.LastName); + lock (m_UserCache) + m_UserCache.Remove(id); + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Re-adding user with id {0}, creatorData [{1}] and old HomeURL {2}", id, creatorData, oldUser.HomeURL); } else { - UserData user = new UserData(); - user.Id = id; + //we have already a valid user within the cache + return; + } + } - if (creatorData != null && creatorData != string.Empty) - { - //creatorData = ; + UserAccount account = m_Scenes[0].UserAccountService.GetUserAccount(m_Scenes[0].RegionInfo.ScopeID, id); - string[] parts = creatorData.Split(';'); - if (parts.Length >= 1) + if (account != null) + { + AddUser(id, account.FirstName, account.LastName); + } + else + { + UserData user = new UserData(); + user.Id = id; + + if (creatorData != null && creatorData != string.Empty) + { + //creatorData = ; + + string[] parts = creatorData.Split(';'); + if (parts.Length >= 1) + { + user.HomeURL = parts[0]; + try { - user.HomeURL = parts[0]; - try - { - Uri uri = new Uri(parts[0]); - user.LastName = "@" + uri.Authority; - } - catch (UriFormatException) - { - m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); - user.LastName = "@unknown"; - } + Uri uri = new Uri(parts[0]); + user.LastName = "@" + uri.Authority; + } + catch (UriFormatException) + { + m_log.DebugFormat("[SCENE]: Unable to parse Uri {0}", parts[0]); + user.LastName = "@unknown"; } - if (parts.Length >= 2) - user.FirstName = parts[1].Replace(' ', '.'); - } - else - { - user.FirstName = "Unknown"; - user.LastName = "UserUMMAU"; } - - AddUserInternal(user); + if (parts.Length >= 2) + user.FirstName = parts[1].Replace(' ', '.'); } + else + { + user.FirstName = "Unknown"; + user.LastName = "UserUMMAU"; + } + + AddUserInternal(user); } } -- cgit v1.1 From 135e10ba09a527d14a2fea0c6398757ce450c9fa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 11 Jun 2013 23:55:45 +0100 Subject: Uncomment Mic's code and split to create new regression TestAddTemporaryAsset() and TestAddTemporaryLocalAsset() --- .../Asset/Tests/AssetConnectorTests.cs | 64 ++++++++++++++-------- 1 file changed, 41 insertions(+), 23 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs index 7073433..4f75191 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/Tests/AssetConnectorTests.cs @@ -42,7 +42,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests { [TestFixture] - public class AssetConnectorsTests : OpenSimTestCase + public class AssetConnectorTests : OpenSimTestCase { [Test] public void TestAddAsset() @@ -77,7 +77,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests // TODO: Add cache and check that this does receive a copy of the asset } - [Test] public void TestAddTemporaryAsset() { TestHelpers.InMethod(); @@ -93,10 +92,45 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); lasc.Initialise(config); - // If it is local, it should not be stored + // If it is remote, it should be stored + AssetBase a2 = AssetHelpers.CreateNotecardAsset(); + a2.Local = false; + a2.Temporary = true; + + lasc.Store(a2); + + AssetBase retreivedA2 = lasc.Get(a2.ID); + Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); + Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); + Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); + + AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); + Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); + + byte[] retrievedA2Data = lasc.GetData(a2.ID); + Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); + + // TODO: Add cache and check that this does receive a copy of the asset + } + + [Test] + public void TestAddLocalAsset() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + IConfigSource config = new IniConfigSource(); + config.AddConfig("Modules"); + config.Configs["Modules"].Set("AssetServices", "LocalAssetServicesConnector"); + config.AddConfig("AssetService"); + config.Configs["AssetService"].Set("LocalServiceModule", "OpenSim.Services.AssetService.dll:AssetService"); + config.Configs["AssetService"].Set("StorageProvider", "OpenSim.Tests.Common.dll"); + + LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); + lasc.Initialise(config); + AssetBase a1 = AssetHelpers.CreateNotecardAsset(); a1.Local = true; - a1.Temporary = true; lasc.Store(a1); @@ -104,29 +138,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests Assert.That(lasc.GetData(a1.ID), Is.Null); Assert.That(lasc.GetMetadata(a1.ID), Is.Null); - // If it is remote, it should be stored - // AssetBase a2 = AssetHelpers.CreateNotecardAsset(); - // a2.Local = false; - // a2.Temporary = true; - - // lasc.Store(a2); - - // AssetBase retreivedA2 = lasc.Get(a2.ID); - // Assert.That(retreivedA2.ID, Is.EqualTo(a2.ID)); - // Assert.That(retreivedA2.Metadata.ID, Is.EqualTo(a2.Metadata.ID)); - // Assert.That(retreivedA2.Data.Length, Is.EqualTo(a2.Data.Length)); - - // AssetMetadata retrievedA2Metadata = lasc.GetMetadata(a2.ID); - // Assert.That(retrievedA2Metadata.ID, Is.EqualTo(a2.ID)); - - // byte[] retrievedA2Data = lasc.GetData(a2.ID); - // Assert.That(retrievedA2Data.Length, Is.EqualTo(a2.Data.Length)); - // TODO: Add cache and check that this does receive a copy of the asset } [Test] - public void TestAddLocalAsset() + public void TestAddTemporaryLocalAsset() { TestHelpers.InMethod(); // TestHelpers.EnableLogging(); @@ -141,8 +157,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.Tests LocalAssetServicesConnector lasc = new LocalAssetServicesConnector(); lasc.Initialise(config); + // If it is local, it should not be stored AssetBase a1 = AssetHelpers.CreateNotecardAsset(); a1.Local = true; + a1.Temporary = true; lasc.Store(a1); -- cgit v1.1 From 7556a0f699f8474b7ac23cbebacc695c93f374fa Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Jun 2013 17:18:12 -0700 Subject: Add TriggerScenePresenceUpdated events when an animation is added or removed. Shouldn't impact anyone as only DSG seems to use OnScenePresenceUpdated event. Some minor format changes to AnimationSet's ToString(). --- OpenSim/Framework/Animation.cs | 5 ++--- OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs | 8 ++++++-- .../Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 2 ++ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Animation.cs b/OpenSim/Framework/Animation.cs index 8bdf8f4..3425505 100644 --- a/OpenSim/Framework/Animation.cs +++ b/OpenSim/Framework/Animation.cs @@ -125,11 +125,10 @@ namespace OpenSim.Framework Animation other = obj as Animation; if (other != null) { - return (other.AnimID == this.AnimID + return (other.AnimID.Equals(this.AnimID) && other.SequenceNum == this.SequenceNum - && other.ObjectID == this.ObjectID); + && other.ObjectID.Equals(this.ObjectID) ); } - return base.Equals(obj); } diff --git a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs index 5dee64d..b7400ea 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/AnimationSet.cs @@ -312,18 +312,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation buff.Append("dflt="); buff.Append(DefaultAnimation.ToString()); buff.Append(",iDflt="); - if (DefaultAnimation == ImplicitDefaultAnimation) + if (DefaultAnimation.Equals(ImplicitDefaultAnimation)) buff.Append("same"); else buff.Append(ImplicitDefaultAnimation.ToString()); if (m_animations.Count > 0) { buff.Append(",anims="); + bool firstTime = true; foreach (OpenSim.Framework.Animation anim in m_animations) { + if (!firstTime) + buff.Append(","); buff.Append("<"); buff.Append(anim.ToString()); - buff.Append(">,"); + buff.Append(">"); + firstTime = false; } } return buff.ToString(); diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index a701a79..3b5a5bd 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs @@ -94,6 +94,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) { SendAnimPack(); + m_scenePresence.TriggerScenePresenceUpdated(); } } @@ -135,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation if (m_animations.Remove(animID, allowNoDefault)) { SendAnimPack(); + m_scenePresence.TriggerScenePresenceUpdated(); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index bab14dd..774546c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Destructor called on {0}", Name); // } - private void TriggerScenePresenceUpdated() + public void TriggerScenePresenceUpdated() { if (m_scene != null) m_scene.EventManager.TriggerScenePresenceUpdated(this); -- cgit v1.1 From 3cb65f0d3166f976713a7c095eb37e6de05061d0 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 11 Jun 2013 17:58:08 -0700 Subject: BulletSim: when meshing or asset fetching fails, include position and region with the offending object's name in the error message. --- OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs | 40 ++++++++++++++-------- .../Region/Physics/BulletSPlugin/BulletSimTODO.txt | 4 +++ 2 files changed, 30 insertions(+), 14 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs index 202a4ce..006a9c1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs @@ -168,10 +168,10 @@ public abstract class BSShape if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched) { prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; - physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. {1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Fetched asset would not mesh. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,setFailed,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } else { @@ -238,17 +238,17 @@ public abstract class BSShape { if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch) { - physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. obj={1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Mesh failed to fetch asset. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailed,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing) { - physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. obj={1}, texture={2}", - LogHeader, prim.PhysObjectName, prim.BaseShape.SculptTexture); - physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,objNam={1},tex={2}", - prim.LocalID, prim.PhysObjectName, prim.BaseShape.SculptTexture); + physicsScene.Logger.WarnFormat("{0} Mesh asset would not mesh. prim={1}, texture={2}", + LogHeader, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); + physicsScene.DetailLog("{0},BSShape.VerifyMeshCreated,wasFailedMeshing,prim={1},tex={2}", + prim.LocalID, UsefulPrimInfo(physicsScene, prim), prim.BaseShape.SculptTexture); } } } @@ -260,6 +260,19 @@ public abstract class BSShape return fillShape.physShapeInfo; } + public static String UsefulPrimInfo(BSScene pScene, BSPhysObject prim) + { + StringBuilder buff = new StringBuilder(prim.PhysObjectName); + buff.Append("/pos="); + buff.Append(prim.RawPosition.ToString()); + if (pScene != null) + { + buff.Append("/rgn="); + buff.Append(pScene.Name); + } + return buff.ToString(); + } + #endregion // Common shape routines } @@ -528,8 +541,7 @@ public class BSShapeMesh : BSShape { // Force the asset condition to 'failed' so we won't try to keep fetching and processing this mesh. prim.PrimAssetState = BSPhysObject.PrimAssetCondition.FailedMeshing; - physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}", - LogHeader, prim.PhysObjectName, prim.RawPosition, physicsScene.Name); + physicsScene.Logger.DebugFormat("{0} All mesh triangles degenerate. Prim={1}", LogHeader, UsefulPrimInfo(physicsScene, prim) ); physicsScene.DetailLog("{0},BSShapeMesh.CreatePhysicalMesh,allDegenerate,key={1}", prim.LocalID, newMeshKey); } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index 1e01526..4357ef1 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -1,5 +1,9 @@ CURRENT PROBLEMS TO FIX AND/OR LOOK AT ================================================= +Vehicle buoyancy. Computed correctly? Possibly creating very large effective mass. + Interaction of llSetBuoyancy and vehicle buoyancy. Should be additive? + Negative buoyancy computed correctly +Computation of mesh mass. How done? How should it be done? Script changing rotation of child prim while vehicle moving (eg turning wheel) causes the wheel to appear to jump back. Looks like sending position from previous update. Enable vehicle border crossings (at least as poorly as ODE) -- cgit v1.1 From 47b6e78790be5a4b7d8a0f4c860f1e2f6f87b137 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Jun 2013 21:34:20 +0100 Subject: Implement logging of first 80 characters (debug level 5) or full body data (debug level 6) on outgoing requests, depending on debug level This is set via "debug http out " This matches the existing debug level behaviours for logging incoming http data --- OpenSim/Framework/Servers/MainServer.cs | 8 +++-- OpenSim/Framework/WebUtil.cs | 54 +++++++++++++++++++++++++++++++-- 2 files changed, 57 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Framework/Servers/MainServer.cs b/OpenSim/Framework/Servers/MainServer.cs index cfd34bb..d189580 100644 --- a/OpenSim/Framework/Servers/MainServer.cs +++ b/OpenSim/Framework/Servers/MainServer.cs @@ -121,12 +121,14 @@ namespace OpenSim.Framework.Servers + " level >= 2 then long warnings are logged when receiving bad input data.\n" + " level >= 3 then short notices about all incoming non-poll HTTP requests are logged.\n" + " level >= 4 then the time taken to fulfill the request is logged.\n" - + " level >= 5 then a sample from the beginning of the incoming data is logged.\n" - + " level >= 6 then the entire incoming data is logged.\n" + + " level >= 5 then a sample from the beginning of the data is logged.\n" + + " level >= 6 then the entire data is logged.\n" + " no level is specified then the current level is returned.\n\n" + "If out or all and\n" + " level >= 3 then short notices about all outgoing requests going through WebUtil are logged.\n" - + " level >= 4 then the time taken to fulfill the request is logged.\n", + + " level >= 4 then the time taken to fulfill the request is logged.\n" + + " level >= 5 then a sample from the beginning of the data is logged.\n" + + " level >= 6 then the entire data is logged.\n", HandleDebugHttpCommand); } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 701fbb0..4599f62 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -151,6 +151,39 @@ namespace OpenSim.Framework } } + public static void LogOutgoingDetail(Stream outputStream) + { + using (StreamReader reader = new StreamReader(Util.Copy(outputStream), Encoding.UTF8)) + { + string output; + + if (DebugLevel == 5) + { + const int sampleLength = 80; + char[] sampleChars = new char[sampleLength]; + reader.Read(sampleChars, 0, sampleLength); + output = new string(sampleChars); + } + else + { + output = reader.ReadToEnd(); + } + + LogOutgoingDetail(output); + } + } + + public static void LogOutgoingDetail(string output) + { + if (DebugLevel == 5) + { + output = output.Substring(0, 80); + output = output + "..."; + } + + m_log.DebugFormat("[WEB UTIL]: {0}", output.Replace("\n", @"\n")); + } + private static OSDMap ServiceOSDRequestWorker(string url, OSDMap data, string method, int timeout, bool compressed) { int reqnum = RequestNumber++; @@ -178,7 +211,11 @@ namespace OpenSim.Framework // If there is some input, write it into the request if (data != null) { - strBuffer = OSDParser.SerializeJsonString(data); + strBuffer = OSDParser.SerializeJsonString(data); + + if (DebugLevel >= 5) + LogOutgoingDetail(strBuffer); + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); if (compressed) @@ -357,6 +394,10 @@ namespace OpenSim.Framework if (data != null) { queryString = BuildQueryString(data); + + if (DebugLevel >= 5) + LogOutgoingDetail(queryString); + byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); request.ContentLength = buffer.Length; @@ -767,6 +808,9 @@ namespace OpenSim.Framework int length = (int)buffer.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + request.BeginGetRequestStream(delegate(IAsyncResult res) { Stream requestStream = request.EndGetRequestStream(res); @@ -954,6 +998,9 @@ namespace OpenSim.Framework length = (int)obj.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + Stream requestStream = null; try { @@ -1096,6 +1143,9 @@ namespace OpenSim.Framework int length = (int)buffer.Length; request.ContentLength = length; + if (WebUtil.DebugLevel >= 5) + WebUtil.LogOutgoingDetail(buffer); + Stream requestStream = null; try { @@ -1198,4 +1248,4 @@ namespace OpenSim.Framework return deserial; } } -} +} \ No newline at end of file -- cgit v1.1 From 824a4b480873721a4a10598299b185b602e1931d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 12 Jun 2013 23:47:47 +0100 Subject: After calls to GetSuitcaseXFolder() in HGSuitcaseInventoryService, consistently check for null return and log warning rather than throw exception. This was being done already in some places. If an exception is thrown it is now an error rather than debug --- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- .../HypergridService/HGSuitcaseInventoryService.cs | 24 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 64127c2..9d28dc3 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -155,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset } catch (Exception e) { - m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); + m_log.ErrorFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace); } return FailureResult(); diff --git a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs index eecf757..410916f 100644 --- a/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGSuitcaseInventoryService.cs @@ -115,6 +115,12 @@ namespace OpenSim.Services.HypergridService { XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); + if (suitcase == null) + { + m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for inventory skeleton", principalID); + return null; + } + List tree = GetFolderTree(principalID, suitcase.folderID); if (tree == null || (tree != null && tree.Count == 0)) return null; @@ -134,6 +140,7 @@ namespace OpenSim.Services.HypergridService public override InventoryCollection GetUserInventory(UUID userID) { m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: Get Suitcase inventory for user {0}", userID); + InventoryCollection userInventory = new InventoryCollection(); userInventory.UserID = userID; userInventory.Folders = new List(); @@ -141,6 +148,12 @@ namespace OpenSim.Services.HypergridService XInventoryFolder suitcase = GetSuitcaseXFolder(userID); + if (suitcase == null) + { + m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for user inventory", userID); + return null; + } + List tree = GetFolderTree(userID, suitcase.folderID); if (tree == null || (tree != null && tree.Count == 0)) { @@ -182,7 +195,8 @@ namespace OpenSim.Services.HypergridService m_log.DebugFormat("[HG SUITCASE INVENTORY SERVICE]: GetRootFolder for {0}", principalID); // Let's find out the local root folder - XInventoryFolder root = GetRootXFolder(principalID); ; + XInventoryFolder root = GetRootXFolder(principalID); + if (root == null) { m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Unable to retrieve local root folder for user {0}", principalID); @@ -255,6 +269,13 @@ namespace OpenSim.Services.HypergridService { //m_log.DebugFormat("[HG INVENTORY SERVICE]: GetFolderForType for {0} {0}", principalID, type); XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); + + if (suitcase == null) + { + m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: Found no suitcase folder for user {0} when looking for child type folder {1}", principalID, type); + return null; + } + XInventoryFolder[] folders = m_Database.GetFolders( new string[] { "agentID", "type", "parentFolderID" }, new string[] { principalID.ToString(), ((int)type).ToString(), suitcase.folderID.ToString() }); @@ -546,6 +567,7 @@ namespace OpenSim.Services.HypergridService private bool IsWithinSuitcaseTree(UUID principalID, UUID folderID) { XInventoryFolder suitcase = GetSuitcaseXFolder(principalID); + if (suitcase == null) { m_log.WarnFormat("[HG SUITCASE INVENTORY SERVICE]: User {0} does not have a Suitcase folder", principalID); -- cgit v1.1 From 33573003620674f4a4f6c8fadd969c7aa6576a5d Mon Sep 17 00:00:00 2001 From: teravus Date: Wed, 12 Jun 2013 18:13:00 -0500 Subject: * This fixes having to select and deselect prim to get keyframemotion to start running when pulled from data storage. --- OpenSim/Data/MySQL/MySQLSimulationData.cs | 2 -- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 5 +++-- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 448962a..de52623 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs @@ -457,8 +457,6 @@ namespace OpenSim.Data.MySQL if (prim.ParentUUID == UUID.Zero) { objects[prim.UUID] = new SceneObjectGroup(prim); - if (prim.KeyframeMotion != null) - prim.KeyframeMotion.UpdateSceneObject(objects[prim.UUID]); } } diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 70b76c9..c35bba2 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -732,11 +732,12 @@ namespace OpenSim.Data.SQLite } SceneObjectGroup group = new SceneObjectGroup(prim); - if (prim.KeyframeMotion != null) - prim.KeyframeMotion.UpdateSceneObject(group); + createdObjects.Add(group.UUID, group); retvals.Add(group); LoadItems(prim); + + } } catch (Exception e) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index da80e4f..7b5fdcb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -763,6 +763,11 @@ namespace OpenSim.Region.Framework.Scenes for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; + if (part.KeyframeMotion != null) + { + part.KeyframeMotion.UpdateSceneObject(this); + } + if (Object.ReferenceEquals(part, m_rootPart)) continue; -- cgit v1.1 From 7759b05dcb39298c0b47da827eda7250db5c2c83 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 13 Jun 2013 00:31:32 +0100 Subject: Make XInventoryServicesConnector properly handle a RESULT = false return for methods where this contains failure rather than throwing an exception. Result = False is generated for methods such as GetFolderForType() when the other end wants to signal a failure of the operation in methods such as GetFolderForType() --- .../Inventory/XInventoryServicesConnector.cs | 124 ++++++++++----------- 1 file changed, 56 insertions(+), 68 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs index 44f5e01..36d4ae2 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryServicesConnector.cs @@ -84,6 +84,30 @@ namespace OpenSim.Services.Connectors m_ServerURI = serviceURI; } + private bool CheckReturn(Dictionary ret) + { + if (ret == null) + return false; + + if (ret.Count == 0) + return false; + + if (ret.ContainsKey("RESULT")) + { + if (ret["RESULT"] is string) + { + bool result; + + if (bool.TryParse((string)ret["RESULT"], out result)) + return result; + + return false; + } + } + + return true; + } + public bool CreateUserInventory(UUID principalID) { Dictionary ret = MakeRequest("CREATEUSERINVENTORY", @@ -91,12 +115,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return false; - if (ret.Count == 0) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public List GetInventorySkeleton(UUID principalID) @@ -106,9 +125,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders = (Dictionary)ret["FOLDERS"]; @@ -135,9 +152,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -151,9 +166,7 @@ namespace OpenSim.Services.Connectors { "TYPE", ((int)type).ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -174,9 +187,7 @@ namespace OpenSim.Services.Connectors { "FOLDER", folderID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders = @@ -205,9 +216,7 @@ namespace OpenSim.Services.Connectors { "FOLDER", folderID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary items = (Dictionary)ret["ITEMS"]; @@ -230,10 +239,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool UpdateFolder(InventoryFolderBase folder) @@ -248,10 +254,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool MoveFolder(InventoryFolderBase folder) @@ -263,10 +266,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", folder.Owner.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool DeleteFolders(UUID principalID, List folderIDs) @@ -282,10 +282,7 @@ namespace OpenSim.Services.Connectors { "FOLDERS", slist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool PurgeFolder(InventoryFolderBase folder) @@ -295,10 +292,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool AddItem(InventoryItemBase item) @@ -330,10 +324,7 @@ namespace OpenSim.Services.Connectors { "CreationDate", item.CreationDate.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool UpdateItem(InventoryItemBase item) @@ -365,10 +356,7 @@ namespace OpenSim.Services.Connectors { "CreationDate", item.CreationDate.ToString() } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool MoveItems(UUID principalID, List items) @@ -389,10 +377,7 @@ namespace OpenSim.Services.Connectors { "DESTLIST", destlist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public bool DeleteItems(UUID principalID, List itemIDs) @@ -408,10 +393,7 @@ namespace OpenSim.Services.Connectors { "ITEMS", slist } }); - if (ret == null) - return false; - - return bool.Parse(ret["RESULT"].ToString()); + return CheckReturn(ret); } public InventoryItemBase GetItem(InventoryItemBase item) @@ -423,9 +405,7 @@ namespace OpenSim.Services.Connectors { "ID", item.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildItem((Dictionary)ret["item"]); @@ -447,9 +427,7 @@ namespace OpenSim.Services.Connectors { "ID", folder.ID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; return BuildFolder((Dictionary)ret["folder"]); @@ -469,7 +447,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) + if (!CheckReturn(ret)) return null; List items = new List(); @@ -488,10 +466,22 @@ namespace OpenSim.Services.Connectors { "ASSET", assetID.ToString() } }); + // We cannot use CheckReturn() here because valid values for RESULT are "false" (in the case of request failure) or an int if (ret == null) return 0; - return int.Parse(ret["RESULT"].ToString()); + if (ret.ContainsKey("RESULT")) + { + if (ret["RESULT"] is string) + { + int intResult; + + if (int.TryParse ((string)ret["RESULT"], out intResult)) + return intResult; + } + } + + return 0; } public InventoryCollection GetUserInventory(UUID principalID) @@ -508,9 +498,7 @@ namespace OpenSim.Services.Connectors { "PRINCIPAL", principalID.ToString() } }); - if (ret == null) - return null; - if (ret.Count == 0) + if (!CheckReturn(ret)) return null; Dictionary folders = -- cgit v1.1 From 7c00ccb548154c73e9953be19122e4750ef781bd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 12 Jun 2013 17:48:20 -0700 Subject: DataSnapshot: changed those annoying messages to Debug instead of Info. --- OpenSim/Region/DataSnapshot/DataRequestHandler.cs | 4 ++-- OpenSim/Region/DataSnapshot/SnapshotStore.cs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs index 32e93b4..50276ae 100644 --- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs +++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.DataSnapshot public Hashtable OnGetSnapshot(Hashtable keysvals) { - m_log.Info("[DATASNAPSHOT] Received collection request"); + m_log.Debug("[DATASNAPSHOT] Received collection request"); Hashtable reply = new Hashtable(); int statuscode = 200; @@ -80,7 +80,7 @@ namespace OpenSim.Region.DataSnapshot public Hashtable OnValidate(Hashtable keysvals) { - m_log.Info("[DATASNAPSHOT] Received validation request"); + m_log.Debug("[DATASNAPSHOT] Received validation request"); Hashtable reply = new Hashtable(); int statuscode = 200; diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index aa3d2ff..480aaaf 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -120,7 +120,7 @@ namespace OpenSim.Region.DataSnapshot provider.Stale = false; m_scenes[provider.GetParentScene] = true; - m_log.Info("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name); + m_log.Debug("[DATASNAPSHOT]: Generated fragment response for provider type " + provider.Name); } else { @@ -134,7 +134,7 @@ namespace OpenSim.Region.DataSnapshot data = factory.ImportNode(node, true); } - m_log.Info("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name); + m_log.Debug("[DATASNAPSHOT]: Retrieved fragment response for provider type " + provider.Name); } return data; @@ -154,7 +154,7 @@ namespace OpenSim.Region.DataSnapshot if (!m_scenes[scene]) { - m_log.Info("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache."); + m_log.Debug("[DATASNAPSHOT]: Attempting to retrieve snapshot from cache."); //get snapshot from cache String path = DataFileNameScene(scene); @@ -168,11 +168,11 @@ namespace OpenSim.Region.DataSnapshot regionElement = factory.ImportNode(node, true); } - m_log.Info("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName); + m_log.Debug("[DATASNAPSHOT]: Obtained snapshot from cache for " + scene.RegionInfo.RegionName); } else { - m_log.Info("[DATASNAPSHOT]: Attempting to generate snapshot."); + m_log.Debug("[DATASNAPSHOT]: Attempting to generate snapshot."); //make snapshot regionElement = MakeRegionNode(scene, factory); @@ -211,7 +211,7 @@ namespace OpenSim.Region.DataSnapshot m_scenes[scene] = false; - m_log.Info("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName); + m_log.Debug("[DATASNAPSHOT]: Generated new snapshot for " + scene.RegionInfo.RegionName); } return regionElement; -- cgit v1.1