From bfa22e2f52780d532db9b8a59f9751390d072c2c Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 25 Aug 2012 23:49:37 +0200 Subject: [PATCH 1/4] Make llCollisionSprite not throw anymore --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d8ef772246..5830eff22f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -12818,7 +12818,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCollisionSprite(string impact_sprite) { m_host.AddScriptLPS(1); - NotImplemented("llCollisionSprite"); + // Viewer 2.0 broke this and it's likely LL has no intention + // of fixing it. Therefore, letting this be a NOP seems appropriate. } public void llGodLikeRezObject(string inventory, LSL_Vector pos) From 67f18655d50914857a1fffe75995155e7a6d5b8e Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 29 Aug 2012 22:06:43 +0200 Subject: [PATCH 2/4] Allow llList2Key to also act on System.String --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7dae53a280..d5e611c5e4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5475,7 +5475,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // for completion and should LSL_Key ever be implemented // as it's own struct else if (!(src.Data[index] is LSL_String || - src.Data[index] is LSL_Key)) + src.Data[index] is LSL_Key || + src.Data[index] is String)) { return ""; } From 211f4fb4114b2b26abe9c056bca9f6159ccbd125 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 30 Aug 2012 00:34:12 +0200 Subject: [PATCH 3/4] Sequence inventory descendents requests to reduce inventory server load and movement lag. --- .../ClientStack/Linden/UDP/LLUDPServer.cs | 1 + .../Framework/Scenes/Scene.PacketHandlers.cs | 60 +++++++++++++++++-- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 75a47d5379..d6513c5403 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -927,6 +927,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP packetInbox.EnqueueHigh(new IncomingPacket((LLClientView)client, packet)); else packetInbox.EnqueueLow(new IncomingPacket((LLClientView)client, packet)); +// packetInbox.Enqueue(new IncomingPacket((LLClientView)client, packet)); } #region BinaryStats diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 431b90302a..e9705435bc 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -422,6 +422,20 @@ namespace OpenSim.Region.Framework.Scenes ); } + private class DescendentsRequestData + { + public IClientAPI RemoteClient; + public UUID FolderID; + public UUID OwnerID; + public bool FetchFolders; + public bool FetchItems; + public int SortOrder; + } + + private Queue m_descendentsRequestQueue = new Queue(); + private Object m_descendentsRequestLock = new Object(); + private bool m_descendentsRequestProcessing = false; + /// /// Tell the client about the various child items and folders contained in the requested folder. /// @@ -458,17 +472,38 @@ namespace OpenSim.Region.Framework.Scenes } } - // We're going to send the reply async, because there may be - // an enormous quantity of packets -- basically the entire inventory! - // We don't want to block the client thread while all that is happening. - SendInventoryDelegate d = SendInventoryAsync; - d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d); + lock (m_descendentsRequestLock) + { + if (!m_descendentsRequestProcessing) + { + m_descendentsRequestProcessing = true; + + // We're going to send the reply async, because there may be + // an enormous quantity of packets -- basically the entire inventory! + // We don't want to block the client thread while all that is happening. + SendInventoryDelegate d = SendInventoryAsync; + d.BeginInvoke(remoteClient, folderID, ownerID, fetchFolders, fetchItems, sortOrder, SendInventoryComplete, d); + + return; + } + + DescendentsRequestData req = new DescendentsRequestData(); + req.RemoteClient = remoteClient; + req.FolderID = folderID; + req.OwnerID = ownerID; + req.FetchFolders = fetchFolders; + req.FetchItems = fetchItems; + req.SortOrder = sortOrder; + + m_descendentsRequestQueue.Enqueue(req); + } } delegate void SendInventoryDelegate(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder); void SendInventoryAsync(IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder) { + Thread.Sleep(20); SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); } @@ -476,6 +511,21 @@ namespace OpenSim.Region.Framework.Scenes { SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; d.EndInvoke(iar); + + lock (m_descendentsRequestLock) + { + if (m_descendentsRequestQueue.Count > 0) + { + DescendentsRequestData req = m_descendentsRequestQueue.Dequeue(); + + d = SendInventoryAsync; + d.BeginInvoke(req.RemoteClient, req.FolderID, req.OwnerID, req.FetchFolders, req.FetchItems, req.SortOrder, SendInventoryComplete, d); + + return; + } + + m_descendentsRequestProcessing = false; + } } /// From 63e6666f2216a34da8327bcd94f94c4ed6c2b254 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 1 Sep 2012 02:05:28 +0100 Subject: [PATCH 4/4] try to reduce potencial recursive locking --- .../World/Land/LandManagementModule.cs | 83 ++++++++++++------- 1 file changed, 54 insertions(+), 29 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 51dcb67fb7..8bc81ae24b 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -86,7 +86,10 @@ namespace OpenSim.Region.CoreModules.World.Land /// /// Land objects keyed by local id /// - private readonly Dictionary m_landList = new Dictionary(); +// private readonly Dictionary m_landList = new Dictionary(); + + //ubit: removed the readonly so i can move it around + private Dictionary m_landList = new Dictionary(); private int m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; @@ -242,15 +245,19 @@ namespace OpenSim.Region.CoreModules.World.Land { LandData newData = data.Copy(); newData.LocalID = local_id; + ILandObject landobj = null; lock (m_landList) { if (m_landList.ContainsKey(local_id)) { m_landList[local_id].LandData = newData; - m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); + landobj = m_landList[local_id]; +// m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]); } } + if(landobj != null) + m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landobj); } public bool AllowedForcefulBans @@ -280,14 +287,14 @@ namespace OpenSim.Region.CoreModules.World.Land protected ILandObject CreateDefaultParcel() { m_log.DebugFormat( - "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); - - ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); + "[LAND MANAGEMENT MODULE]: Creating default parcel for region {0}", m_scene.RegionInfo.RegionName); + + ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); - - return AddLandObject(fullSimParcel); + + return AddLandObject(fullSimParcel); } public List AllParcels() @@ -617,21 +624,28 @@ namespace OpenSim.Region.CoreModules.World.Land /// public void Clear(bool setupDefaultParcel) { + Dictionary landworkList; + // move to work pointer since we are deleting it all lock (m_landList) { - foreach (ILandObject lo in m_landList.Values) - { - //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); - m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); - } - - m_landList.Clear(); - - ResetSimLandObjects(); - - if (setupDefaultParcel) - CreateDefaultParcel(); + landworkList = m_landList; + m_landList = new Dictionary(); } + + // this 2 methods have locks (now) + ResetSimLandObjects(); + + if (setupDefaultParcel) + CreateDefaultParcel(); + + // fire outside events unlocked + foreach (ILandObject lo in landworkList.Values) + { + //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); + m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); + } + landworkList.Clear(); + } private void performFinalLandJoin(ILandObject master, ILandObject slave) @@ -1324,20 +1338,30 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnIncomingLandDataFromStorage(List data) { + Dictionary landworkList; + // move to work pointer since we are deleting it all + lock (m_landList) + { + landworkList = m_landList; + m_landList = new Dictionary(); + } + + //Remove all the land objects in the sim and then process our new data + foreach (int n in landworkList.Keys) + { + m_scene.EventManager.TriggerLandObjectRemoved(landworkList[n].LandData.GlobalID); + } + landworkList.Clear(); + lock (m_landList) { - //Remove all the land objects in the sim and then process our new data - foreach (int n in m_landList.Keys) - { - m_scene.EventManager.TriggerLandObjectRemoved(m_landList[n].LandData.GlobalID); - } m_landIDList.Initialize(); m_landList.Clear(); + } - for (int i = 0; i < data.Count; i++) - { - IncomingLandObjectFromStorage(data[i]); - } + for (int i = 0; i < data.Count; i++) + { + IncomingLandObjectFromStorage(data[i]); } } @@ -1366,7 +1390,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void EventManagerOnNoLandDataFromStorage() { - lock (m_landList) + // called methods already have locks +// lock (m_landList) { ResetSimLandObjects(); CreateDefaultParcel();