From 8010413e645e1aaf655008e216c017943a5d8c76 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:06:42 +0000 Subject: remove some potencial null refs i did add in last days :( --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 8 ++++++-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 8ba26e8..55d4e39 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -620,7 +620,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP m_entityProps = null; m_killRecord.Clear(); GroupsInView.Clear(); - m_scene = null; +// m_scene = null; can't do this unless checks are added everywhere due to workitems already in pools + //m_log.InfoFormat("[CLIENTVIEW] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //GC.Collect(); //m_log.InfoFormat("[CLIENTVIEW] Memory post GC {0}", System.GC.GetTotalMemory(true)); @@ -4371,7 +4372,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP ushort timeDilation; - if(m_scene == null) + if(!IsActive) return; timeDilation = Utils.FloatToUInt16(m_scene.TimeDilation, 0.0f, 1.0f); @@ -12945,6 +12946,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { + if(!IsActive) + return; + if (m_outPacketsToDrop != null) if (m_outPacketsToDrop.Contains(packet.Type.ToString())) return; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index e85cee2..0efa7c5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -299,10 +299,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); - NeedAcks = null; - PendingAcks = null; m_nextPackets = null; - m_packetOutboxes = null; } /// -- cgit v1.1 From b887b7625e03a3923e8eea72353c878bc1d4b3a9 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 19 Nov 2016 21:53:09 +0000 Subject: change OutPacket drop condition --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 55d4e39..05a3191 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12946,12 +12946,20 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { - if(!IsActive) + if(!m_udpClient.IsConnected) + { + PacketPool.Instance.ReturnPacket(packet); return; + } if (m_outPacketsToDrop != null) + { if (m_outPacketsToDrop.Contains(packet.Type.ToString())) + { + PacketPool.Instance.ReturnPacket(packet); return; + } + } if (DebugPacketLevel > 0) { -- cgit v1.1 From 586c81eecda0193e3403135ad308f8e9887f1456 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 01:49:53 +0000 Subject: give up on OutPacket drop condition on closing --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 05a3191..5879e56 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -12946,12 +12946,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// provide your own method. protected void OutPacket(Packet packet, ThrottleOutPacketType throttlePacketType, bool doAutomaticSplitting, UnackedPacketMethod method) { + +/* this is causing packet loss for some reason if(!m_udpClient.IsConnected) { PacketPool.Instance.ReturnPacket(packet); return; } - +*/ if (m_outPacketsToDrop != null) { if (m_outPacketsToDrop.Contains(packet.Type.ToString())) -- cgit v1.1 From 200183caf7c3673e914a7b7f30fbb47bc7e92c44 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 02:49:40 +0000 Subject: HG protocol is still broken for large regions. work around it on teleport via lm --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 0efa7c5..c804e33 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -299,7 +299,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); - m_nextPackets = null; } /// -- cgit v1.1 From f1958e9f71f5ba9b8ca088f23df68336a3c7b43c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 20 Nov 2016 13:36:34 +0000 Subject: revert more object references removal on clients close because 2 many code paths don't have proper abort --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 3 +-- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 5879e56..65a341e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -606,11 +606,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP //m_scene.CloseAllAgents(CircuitCode); // Disable UDP handling for this client - m_udpClient.Shutdown(); - m_udpClient.OnQueueEmpty -= HandleQueueEmpty; m_udpClient.HasUpdates -= HandleHasUpdates; m_udpClient.OnPacketStats -= PopulateStats; + m_udpClient.Shutdown(); // Shutdown the image manager ImageManager.Close(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index c804e33..dc8ac3c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -288,15 +288,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP for (int i = 0; i < THROTTLE_CATEGORY_COUNT; i++) { m_packetOutboxes[i].Clear(); - m_throttleCategories[i] = null; m_nextPackets[i] = null; } // pull the throttle out of the scene throttle m_throttleClient.Parent.UnregisterRequest(m_throttleClient); - m_throttleClient = null; - OnPacketStats = null; - OnQueueEmpty = null; PendingAcks.Clear(); NeedAcks.Clear(); } -- cgit v1.1 From b2c553b459a8390aaadd8f7c65567b1e557226c2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:16:35 +0000 Subject: work around some warnings --- .../Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 + .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 2 +- .../ClientStack/Linden/UDP/OpenSimUDPBase.cs | 5 +++++ .../Region/ClientStack/Linden/UDP/TokenBucket.cs | 22 ++++++++++++++-------- 4 files changed, 21 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index dc8ac3c..9449ffb 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -111,6 +111,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hooked to put more data on the empty queue public event QueueEmpty OnQueueEmpty; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design","CA1009:DeclareEventHandlersCorrectly")] public event Func HasUpdates; /// AgentID for this client diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index af33d17..a868e3a 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -521,7 +521,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // if (usePools) // EnablePools(); - DisablePools(); + base.DisablePools(); } public void Start() diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 7171974..4d726b4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs @@ -179,6 +179,11 @@ namespace OpenMetaverse // m_dropRandomGenerator = new Random(); } + ~OpenSimUDPBase() + { + if(m_udpSocket !=null) + try { m_udpSocket.Close(); } catch { } + } /// /// Start inbound UDP packet handling. /// diff --git a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs index d4603f8..cac57b2 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/TokenBucket.cs @@ -97,7 +97,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// protected float m_burst; - public virtual float MaxDripRate { get; set; } + protected float m_maxDripRate = 0; + public virtual float MaxDripRate + { + get { return m_maxDripRate; } + set { m_maxDripRate = value; } + } public float RequestedBurst { @@ -134,7 +139,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// the system tick interval (typically around 15-22ms) protected float m_dripRate; - public virtual float RequestedDripRate + public float RequestedDripRate { get { return (m_dripRate == 0 ? m_totalDripRequest : m_dripRate); } set { @@ -146,7 +151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP } } - public virtual float DripRate + public float DripRate { get { float rate = Math.Min(RequestedDripRate,TotalDripRequest); @@ -344,7 +349,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP // greater than this. // - protected float m_maxDripRate = 0; public override float MaxDripRate { get { return (m_maxDripRate == 0 ? m_totalDripRequest : m_maxDripRate); } @@ -359,7 +363,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // // Adjust drip rate in response to network conditions. // - public virtual float AdjustedDripRate + public float AdjustedDripRate { get { return m_dripRate; } set @@ -380,12 +384,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP { m_enabled = enabled; - MaxDripRate = maxDripRate; + m_maxDripRate = (maxDripRate == 0 ? m_totalDripRequest : Math.Max(maxDripRate, m_minimumFlow)); if (enabled) - AdjustedDripRate = m_maxDripRate * .5f; + m_dripRate = m_maxDripRate * .5f; else - AdjustedDripRate = m_maxDripRate; + m_dripRate = m_maxDripRate; + if (m_parent != null) + m_parent.RegisterRequest(this, m_dripRate); } /// -- cgit v1.1 From f794ab1a6702cdfc073eec17168c280891b941b4 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 21 Nov 2016 01:22:01 +0000 Subject: remove something VS decided to add --- OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs | 1 - 1 file changed, 1 deletion(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs index 9449ffb..dc8ac3c 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPClient.cs @@ -111,7 +111,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// hooked to put more data on the empty queue public event QueueEmpty OnQueueEmpty; - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design","CA1009:DeclareEventHandlersCorrectly")] public event Func HasUpdates; /// AgentID for this client -- cgit v1.1 From f4745e5a354871c5b248d10bb57f40cae5cc788c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 22 Nov 2016 22:24:54 +0000 Subject: full change ServiceThrottleModule. Let it still service RegionHandleRequest and UUIDNameRequest but this wrong since they are diferent services. Keeping gambling about not having 2 much overlaps of the 2 kind of requests. Remove double thottling of RegionHandleRequest --- .../Region/ClientStack/Linden/UDP/LLClientView.cs | 52 ++-------------------- 1 file changed, 4 insertions(+), 48 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 65a341e..f472dba 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -9614,61 +9614,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP #region Parcel related packets - // acumulate several HandleRegionHandleRequest consecutive overlaping requests - // to be done with minimal resources as possible - // variables temporary here while in test - - Queue RegionHandleRequests = new Queue(); - bool RegionHandleRequestsInService = false; - private bool HandleRegionHandleRequest(IClientAPI sender, Packet Pack) { - UUID currentUUID; - RegionHandleRequest handlerRegionHandleRequest = OnRegionHandleRequest; - if (handlerRegionHandleRequest == null) - return true; - - RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; - - lock (RegionHandleRequests) + if (handlerRegionHandleRequest != null) { - if (RegionHandleRequestsInService) - { - // we are already busy doing a previus request - // so enqueue it - RegionHandleRequests.Enqueue(rhrPack.RequestBlock.RegionID); - return true; - } - - // else do it - currentUUID = rhrPack.RequestBlock.RegionID; - RegionHandleRequestsInService = true; + RegionHandleRequestPacket rhrPack = (RegionHandleRequestPacket)Pack; + handlerRegionHandleRequest(this, rhrPack.RequestBlock.RegionID); } - while (true) - { - handlerRegionHandleRequest(this, currentUUID); - - lock (RegionHandleRequests) - { - // exit condition, nothing to do or closed - // current code seems to assume we may loose the handler at anytime, - // so keep checking it - handlerRegionHandleRequest = OnRegionHandleRequest; - - if (RegionHandleRequests.Count == 0 || !IsActive || handlerRegionHandleRequest == null) - { - RegionHandleRequests.Clear(); - RegionHandleRequestsInService = false; - return true; - } - currentUUID = RegionHandleRequests.Dequeue(); - } - } - - return true; // actually unreached + return true; } private bool HandleParcelInfoRequest(IClientAPI sender, Packet Pack) -- cgit v1.1 From 82ed6bde6e7258ee8380a2e8466d4a7e32c9e5e6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Nov 2016 10:00:56 +0000 Subject: fix maturity on parcelInfo --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f472dba..498d5fe 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -3126,10 +3126,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP reply.Data.ActualArea = land.Area; reply.Data.BillableArea = land.Area; // TODO: what is this? - // Bit 0: Mature, bit 7: on sale, other bits: no idea - reply.Data.Flags = (byte)( - (info.AccessLevel > 13 ? (1 << 0) : 0) + - ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0)); + reply.Data.Flags = (byte)Util.ConvertAccessLevelToMaturity((byte)info.AccessLevel); + if((land.Flags & (uint)ParcelFlags.ForSale) != 0) + reply.Data.Flags |= (byte)((1 << 7)); Vector3 pos = land.UserLocation; if (pos.Equals(Vector3.Zero)) -- cgit v1.1 From 5cc0d6620de4dd5c5b532ee284c8f873d0342ecb Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 26 Nov 2016 05:08:46 +0000 Subject: remove 2 more null refs i added to release memory --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/ClientStack/Linden') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 498d5fe..6cdf6f6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -615,8 +615,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP ImageManager.Close(); ImageManager = null; - m_entityUpdates = null; - m_entityProps = null; + m_entityUpdates = new PriorityQueue(1); + m_entityProps = new PriorityQueue(1); m_killRecord.Clear(); GroupsInView.Clear(); // m_scene = null; can't do this unless checks are added everywhere due to workitems already in pools -- cgit v1.1