From e271607befc952c8b9a000a7405f871fa10e92a0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Sep 2014 18:52:07 +0100 Subject: [PATCH 01/12] For stat names containing periods, replace with '#' rather than throw exception In relation to http://opensimulator.org/mantis/view.php?id=7317 --- OpenSim/Framework/Monitoring/Stats/Stat.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index e095801f2a..df55314c30 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -171,7 +171,8 @@ namespace OpenSim.Framework.Monitoring foreach (char c in DisallowedShortNameCharacters) { if (shortName.IndexOf(c) != -1) - throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c)); + shortName = shortName.Replace('c', '#'); +// throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c)); } ShortName = shortName; From b4ce71df1e02c86c6b8470dd7429b21af559d644 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 9 Sep 2014 18:55:38 +0100 Subject: [PATCH 02/12] Make proper fix for last commit wrt Mantis 7317 by replacing disallowed c char and not literal 'c' --- OpenSim/Framework/Monitoring/Stats/Stat.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index df55314c30..a7cb2a6ae9 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs @@ -171,7 +171,7 @@ namespace OpenSim.Framework.Monitoring foreach (char c in DisallowedShortNameCharacters) { if (shortName.IndexOf(c) != -1) - shortName = shortName.Replace('c', '#'); + shortName = shortName.Replace(c, '#'); // throw new Exception(string.Format("Stat name {0} cannot contain character {1}", shortName, c)); } From a3bd708e772a108169eead039ca4490dd3a52f8b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 11 Sep 2014 20:59:20 +0100 Subject: [PATCH 03/12] Fix regression from recent a02dae5 where stand positions are no longer correct when a sit target is specified. Adjusts stand position using just avatar position relative to the root prim instead. Fixes http://opensimulator.org/mantis/view.php?id=7315 and preserves previous fix for http://opensimulator.org/mantis/view.php?id=7299 --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 59b521db5f..87063c6d4c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2618,7 +2618,6 @@ namespace OpenSim.Region.Framework.Scenes } } - Vector3 sitPartWorldPosition = part.GetWorldPosition(); ControllingClient.SendClearFollowCamProperties(part.ParentUUID); ParentID = 0; @@ -2647,13 +2646,13 @@ namespace OpenSim.Region.Framework.Scenes // Vector3 standPositionAdjustment // = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f); - Vector3 adjustmentForSitPosition = (part.SitTargetPosition + OffsetPosition) * part.GetWorldRotation(); + Vector3 adjustmentForSitPosition = (OffsetPosition - SIT_TARGET_ADJUSTMENT) * part.GetWorldRotation(); // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than // hardcoding here. Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation; - Vector3 standPos = sitPartWorldPosition + adjustmentForSitPosition + adjustmentForSitPose; + Vector3 standPos = part.ParentGroup.AbsolutePosition + adjustmentForSitPosition + adjustmentForSitPose; // m_log.DebugFormat( // "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}", From 70953dbfcdf70b24fb939252775fa5e2a7ac2316 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Sep 2014 00:34:39 +0100 Subject: [PATCH 04/12] Fix issues where setting llSetTextureAnim(FALSE... did not work properly). I ended up amalgamating patches from http://opensimulator.org/mantis/view.php?id=7313 and http://opensimulator.org/mantis/view.php?id=7318 Thanks a lot to both bobshaffer2 and cinderblocks. --- .../Framework/Scenes/SceneObjectPart.cs | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8785ca97d8..c587b2aff4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1589,20 +1589,29 @@ namespace OpenSim.Region.Framework.Scenes public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim) { - byte[] data = new byte[16]; - int pos = 0; + byte[] data; - // The flags don't like conversion from uint to byte, so we have to do - // it the crappy way. See the above function :( + if (pTexAnim.Flags == Primitive.TextureAnimMode.ANIM_OFF) + { + data = Utils.EmptyBytes; + } + else + { + data = new byte[16]; + int pos = 0; - data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; - data[pos] = (byte)pTexAnim.Face; pos++; - data[pos] = (byte)pTexAnim.SizeX; pos++; - data[pos] = (byte)pTexAnim.SizeY; pos++; + // The flags don't like conversion from uint to byte, so we have to do + // it the crappy way. See the above function :( - Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); - Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); - Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + data[pos] = ConvertScriptUintToByte((uint)pTexAnim.Flags); pos++; + data[pos] = (byte)pTexAnim.Face; pos++; + data[pos] = (byte)pTexAnim.SizeX; pos++; + data[pos] = (byte)pTexAnim.SizeY; pos++; + + Utils.FloatToBytes(pTexAnim.Start).CopyTo(data, pos); + Utils.FloatToBytes(pTexAnim.Length).CopyTo(data, pos + 4); + Utils.FloatToBytes(pTexAnim.Rate).CopyTo(data, pos + 8); + } m_TextureAnimation = data; } From 3f35c5a421574cfe48e6c76dc195fe30da896e69 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Sep 2014 00:36:45 +0100 Subject: [PATCH 05/12] Add cinderblocks and bobshaffer2 to contributors. --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 089a7a27b4..4c01dd1d58 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -72,10 +72,12 @@ what it is today. * Allen Kerensky * BigFootAg * BlueWall Slade +* bobshaffer2 * brianw/Sir_Ahzz * CharlieO * ChrisDown * Chris Yeoh (IBM) +* cinderblocks * controlbreak * coyled * ctrlaltdavid (David Rowe) From 2d3072f053f172a1c75c98151a960b951a7a20b1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Sep 2014 23:37:44 +0100 Subject: [PATCH 06/12] When osNpcMoveToTarget() is called for a sitting avatar then silently do nothing rather than throwing an error. Resolves http://opensimulator.org/mantis/view.php?id=7311 --- OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 03c6265fec..95e59ab38e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -234,6 +234,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC ScenePresence sp; if (scene.TryGetScenePresence(agentID, out sp)) { + if (sp.IsSatOnObject || sp.SitGround) + return false; + // m_log.DebugFormat( // "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", // sp.Name, pos, scene.RegionInfo.RegionName, From af286d5fcb688e8b64202b6deca4f249e9a2b6b8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 17 Sep 2014 17:56:10 -0400 Subject: [PATCH 07/12] Small changes to threading to send thread names to unmanaged threads. Needs Mono 3.6+ to see thread names in utilities like top -H . Some formatting of the thread name to fin in the 16 byte limit on Linux. Please test on Windows to see if the work has any adverse effects. --- OpenSim/Framework/Monitoring/Watchdog.cs | 13 +++++++------ .../Servers/HttpServer/OSHttpRequestPump.cs | 4 ++-- .../Framework/Servers/HttpServer/OSHttpServer.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++- ThirdParty/SmartThreadPool/SmartThreadPool.cs | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index e9e7bd21c0..e9f22f1b07 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring /// public Stat Stat { get; set; } - public ThreadWatchdogInfo(Thread thread, int timeout) + public ThreadWatchdogInfo(Thread thread, int timeout, string name) { Thread = thread; Timeout = timeout; @@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring Stat = new Stat( - thread.Name, - string.Format("Last update of thread {0}", thread.Name), + name, + string.Format("Last update of thread {0}", name), "", "ms", "server", @@ -216,12 +216,11 @@ namespace OpenSim.Framework.Monitoring bool alarmIfTimeout, Func alarmMethod, int timeout, bool log = true) { Thread thread = new Thread(start); - thread.Name = name; thread.Priority = priority; thread.IsBackground = isBackground; ThreadWatchdogInfo twi - = new ThreadWatchdogInfo(thread, timeout) + = new ThreadWatchdogInfo(thread, timeout, name) { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; if (log) @@ -230,8 +229,10 @@ namespace OpenSim.Framework.Monitoring lock (m_threads) m_threads.Add(twi.Thread.ManagedThreadId, twi); - + thread.Start(); + thread.Name = name; + return thread; } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs index 77cfb7e472..bdea278810 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs @@ -70,9 +70,9 @@ namespace OpenSim.Framework.Servers.HttpServer _id = id; _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } @@ -91,9 +91,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs index 84aa31b824..cd6284259a 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs @@ -150,9 +150,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = _engineId; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",_engineId); ThreadTracker.Add(_engine); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 28dbccb95f..7e4d9ed3b0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1079,6 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; + + Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_")); } public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) @@ -1396,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes m_heartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); + Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); StartScripts(); } diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index a4f4ce5695..615518ecf1 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -677,7 +677,6 @@ namespace Amib.Threading : new Thread(ProcessQueuedItems); #endif // Configure the new thread and start it - workerThread.Name = "STP " + Name + " Thread #" + _threadCounter; workerThread.IsBackground = _stpStartInfo.AreThreadsBackground; #if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE) @@ -691,6 +690,7 @@ namespace Amib.Threading workerThread.Priority = _stpStartInfo.ThreadPriority; #endif workerThread.Start(); + workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter); ++_threadCounter; // Add it to the dictionary and update its creation time. From 376fab140227e92dbd841436509a97b87c9e7792 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 17 Sep 2014 18:11:41 -0400 Subject: [PATCH 08/12] Revert "Small changes to threading to send thread names to unmanaged threads. Needs Mono 3.6+ to see thread names in utilities like top -H . Some formatting of the thread name to fin in the 16 byte limit on Linux. Please test on Windows to see if the work has any adverse effects." This reverts commit af286d5fcb688e8b64202b6deca4f249e9a2b6b8. Issue with Jenkins builds --- OpenSim/Framework/Monitoring/Watchdog.cs | 13 ++++++------- .../Servers/HttpServer/OSHttpRequestPump.cs | 4 ++-- .../Framework/Servers/HttpServer/OSHttpServer.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +--- ThirdParty/SmartThreadPool/SmartThreadPool.cs | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index e9f22f1b07..e9e7bd21c0 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring /// public Stat Stat { get; set; } - public ThreadWatchdogInfo(Thread thread, int timeout, string name) + public ThreadWatchdogInfo(Thread thread, int timeout) { Thread = thread; Timeout = timeout; @@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring Stat = new Stat( - name, - string.Format("Last update of thread {0}", name), + thread.Name, + string.Format("Last update of thread {0}", thread.Name), "", "ms", "server", @@ -216,11 +216,12 @@ namespace OpenSim.Framework.Monitoring bool alarmIfTimeout, Func alarmMethod, int timeout, bool log = true) { Thread thread = new Thread(start); + thread.Name = name; thread.Priority = priority; thread.IsBackground = isBackground; ThreadWatchdogInfo twi - = new ThreadWatchdogInfo(thread, timeout, name) + = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; if (log) @@ -229,10 +230,8 @@ namespace OpenSim.Framework.Monitoring lock (m_threads) m_threads.Add(twi.Thread.ManagedThreadId, twi); - - thread.Start(); - thread.Name = name; + thread.Start(); return thread; } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs index bdea278810..77cfb7e472 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs @@ -70,9 +70,9 @@ namespace OpenSim.Framework.Servers.HttpServer _id = id; _engine = new Thread(new ThreadStart(Engine)); + _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); - _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } @@ -91,9 +91,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); + _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); - _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs index cd6284259a..84aa31b824 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs @@ -150,9 +150,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); + _engine.Name = _engineId; _engine.IsBackground = true; _engine.Start(); - _engine.Name = string.Format ("Engine:{0}",_engineId); ThreadTracker.Add(_engine); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7e4d9ed3b0..28dbccb95f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1079,8 +1079,6 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; - - Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_")); } public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) @@ -1398,7 +1396,7 @@ namespace OpenSim.Region.Framework.Scenes m_heartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); + Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); StartScripts(); } diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index 615518ecf1..a4f4ce5695 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -677,6 +677,7 @@ namespace Amib.Threading : new Thread(ProcessQueuedItems); #endif // Configure the new thread and start it + workerThread.Name = "STP " + Name + " Thread #" + _threadCounter; workerThread.IsBackground = _stpStartInfo.AreThreadsBackground; #if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE) @@ -690,7 +691,6 @@ namespace Amib.Threading workerThread.Priority = _stpStartInfo.ThreadPriority; #endif workerThread.Start(); - workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter); ++_threadCounter; // Add it to the dictionary and update its creation time. From 427240f935dabeeee272d8c84ed90af5a497b133 Mon Sep 17 00:00:00 2001 From: Edward Date: Mon, 15 Sep 2014 11:56:49 -0700 Subject: [PATCH 09/12] Changes to be committed: modified: OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs modified: OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs This solves mantis bug# 5005: llRegionSay script does not trigger ChatFromWorld event. This was solved by adding World.SimChat() command to the llRegionSay() function (per suggestion of DrCuriosity). Additionally this fixes llRegionSayTo() which was also not functioning by adding a World.SimChat() command and adding a new SimChatToAgent() overrided function to Scene.PacketHandlers.cs This is the second patch revision. Corrections made to the position of World.SimChat() and removal of tabs per suggestion by justincc. --- .../Framework/Scenes/Scene.PacketHandlers.cs | 15 +++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 6 ++++++ 2 files changed, 21 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index cddf8189b1..ea242f5609 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -144,6 +144,21 @@ namespace OpenSim.Region.Framework.Scenes SimChat(message, ChatTypeEnum.Say, 0, fromPos, fromName, fromID, targetID, fromAgent, false); } + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public void SimChatToAgent(UUID targetID, byte[] message, int channel, Vector3 fromPos, string fromName, UUID fromID, bool fromAgent) + { + SimChat(message, ChatTypeEnum.Region, channel, fromPos, fromName, fromID, targetID, fromAgent, false); + } + /// /// Invoked when the client requests a prim. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c384b268f..e7ba7a4f1e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -968,6 +968,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); + World.SimChat(Utils.StringToBytes(text), + ChatTypeEnum.Region, channelID, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false); + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) wComm.DeliverMessage(ChatTypeEnum.Region, channelID, m_host.Name, m_host.UUID, text); @@ -988,6 +991,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api UUID TargetID; UUID.TryParse(target, out TargetID); + World.SimChatToAgent(TargetID, Utils.StringToBytes(msg), + channel, m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, true); + IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface(); if (wComm != null) wComm.DeliverMessageTo(TargetID, channel, m_host.AbsolutePosition, m_host.Name, m_host.UUID, msg); From 1f40630a9a48ed9f9d8e4c39f037bbf4be17121d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 17 Sep 2014 23:45:53 +0100 Subject: [PATCH 10/12] Add eeyore to contributors --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 4c01dd1d58..e3f9d898a5 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -90,6 +90,7 @@ what it is today. * DoranZemlja * dr0b3rts * dslake +* eeyore * FredoChaplin * Garmin Kawaguichi * Gerhard From 96a24491222e29ba8d615d9ffaf63e72742a9cc7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 17 Sep 2014 20:03:54 -0400 Subject: [PATCH 11/12] Undo "Revert "Small changes to threading to send thread names to unmanaged threads. Needs Mono 3.6+ to see thread names in utilities like top -H . Some formatting of the thread name to fin in the 16 byte limit on Linux. Please test on Windows to see if the work has any adverse effects."" Fix for break in next commit This reverts commit 376fab140227e92dbd841436509a97b87c9e7792. --- OpenSim/Framework/Monitoring/Watchdog.cs | 13 +++++++------ .../Servers/HttpServer/OSHttpRequestPump.cs | 4 ++-- .../Framework/Servers/HttpServer/OSHttpServer.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +++- ThirdParty/SmartThreadPool/SmartThreadPool.cs | 2 +- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index e9e7bd21c0..e9f22f1b07 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring /// public Stat Stat { get; set; } - public ThreadWatchdogInfo(Thread thread, int timeout) + public ThreadWatchdogInfo(Thread thread, int timeout, string name) { Thread = thread; Timeout = timeout; @@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring Stat = new Stat( - thread.Name, - string.Format("Last update of thread {0}", thread.Name), + name, + string.Format("Last update of thread {0}", name), "", "ms", "server", @@ -216,12 +216,11 @@ namespace OpenSim.Framework.Monitoring bool alarmIfTimeout, Func alarmMethod, int timeout, bool log = true) { Thread thread = new Thread(start); - thread.Name = name; thread.Priority = priority; thread.IsBackground = isBackground; ThreadWatchdogInfo twi - = new ThreadWatchdogInfo(thread, timeout) + = new ThreadWatchdogInfo(thread, timeout, name) { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; if (log) @@ -230,8 +229,10 @@ namespace OpenSim.Framework.Monitoring lock (m_threads) m_threads.Add(twi.Thread.ManagedThreadId, twi); - + thread.Start(); + thread.Name = name; + return thread; } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs index 77cfb7e472..bdea278810 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs @@ -70,9 +70,9 @@ namespace OpenSim.Framework.Servers.HttpServer _id = id; _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } @@ -91,9 +91,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = EngineID; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",EngineID); ThreadTracker.Add(_engine); } diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs index 84aa31b824..cd6284259a 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs @@ -150,9 +150,9 @@ namespace OpenSim.Framework.Servers.HttpServer public void Start() { _engine = new Thread(new ThreadStart(Engine)); - _engine.Name = _engineId; _engine.IsBackground = true; _engine.Start(); + _engine.Name = string.Format ("Engine:{0}",_engineId); ThreadTracker.Add(_engine); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 28dbccb95f..7e4d9ed3b0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1079,6 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter = new SimStatsReporter(this); StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; + + Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_")); } public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) @@ -1396,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes m_heartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); + Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); StartScripts(); } diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index a4f4ce5695..615518ecf1 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -677,7 +677,6 @@ namespace Amib.Threading : new Thread(ProcessQueuedItems); #endif // Configure the new thread and start it - workerThread.Name = "STP " + Name + " Thread #" + _threadCounter; workerThread.IsBackground = _stpStartInfo.AreThreadsBackground; #if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE) @@ -691,6 +690,7 @@ namespace Amib.Threading workerThread.Priority = _stpStartInfo.ThreadPriority; #endif workerThread.Start(); + workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter); ++_threadCounter; // Add it to the dictionary and update its creation time. From 519c753e4678ba81d15911be4f7bcecb14541a7f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Wed, 17 Sep 2014 20:25:27 -0400 Subject: [PATCH 12/12] This fixes the Scene thread renaming issue --- OpenSim/Region/Framework/Scenes/Scene.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 7e4d9ed3b0..19cb0f8fca 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1080,7 +1080,6 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.OnSendStatsResult += SendSimStatsPackets; StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; - Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_")); } public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo)