From 29f2421d4f0f0852dbb5d8a99bcba4aecade9dc0 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 8 Jun 2017 11:45:33 +0100 Subject: [PATCH 01/10] revert fa5bf4fd0bb6a855eacdb7b5eec9cd71ad9bf606 for test --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index b1b1fc5d68..892403ba49 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1361,8 +1361,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) { - // Get inner XML and pass to MediaList parser - string value = reader.ReadInnerXml(); + string value = reader.ReadElementContentAsString("Media", String.Empty); shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } From ef2fd8fcea311c32582a2fba7d8979c529ff05be Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 8 Jun 2017 20:47:51 +0100 Subject: [PATCH 02/10] keep the reverted code, that does work. Our code likes to have pbs.Media == null when there is no MOAD defined, so handle possible odd oars that may have llsd on that case --- OpenSim/Framework/PrimitiveBaseShape.cs | 49 ++++++++++++++++--------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index a830551793..96d78d3eed 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs @@ -1580,35 +1580,48 @@ namespace OpenSim.Framework { MediaList ml = new MediaList(); ml.ReadXml(rawXml); + if(ml.Count == 0) + return null; return ml; } public void ReadXml(string rawXml) { - using (StringReader sr = new StringReader(rawXml)) + try { - using (XmlTextReader xtr = new XmlTextReader(sr)) + using (StringReader sr = new StringReader(rawXml)) { - xtr.MoveToContent(); - - string type = xtr.GetAttribute("type"); - //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); - - if (type != MEDIA_TEXTURE_TYPE) - return; - - xtr.ReadStartElement("OSMedia"); - - OSDArray osdMeArray = (OSDArray)OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); - foreach (OSD osdMe in osdMeArray) + using (XmlTextReader xtr = new XmlTextReader(sr)) { - MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); - Add(me); - } + xtr.MoveToContent(); - xtr.ReadEndElement(); + string type = xtr.GetAttribute("type"); + //m_log.DebugFormat("[MOAP]: Loaded media texture entry with type {0}", type); + + if (type != MEDIA_TEXTURE_TYPE) + return; + + xtr.ReadStartElement("OSMedia"); + OSD osdp = OSDParser.DeserializeLLSDXml(xtr.ReadInnerXml()); + if(osdp == null || !(osdp is OSDArray)) + return; + + OSDArray osdMeArray = osdp as OSDArray; + if(osdMeArray.Count == 0) + return; + + foreach (OSD osdMe in osdMeArray) + { + MediaEntry me = (osdMe is OSDMap ? MediaEntry.FromOSD(osdMe) : new MediaEntry()); + Add(me); + } + } } } + catch + { + m_log.Debug("PrimitiveBaseShape] error decoding MOAP xml" ); + } } public void ReadXml(XmlReader reader) From 1e3a19e6731634f0f77d14bff6263dc973335e39 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 00:15:53 +0100 Subject: [PATCH 03/10] bug fix plus some cleanup --- .../Scenes/SceneObjectPartInventory.cs | 121 ++++++++++-------- 1 file changed, 65 insertions(+), 56 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 23da90abe3..3fd6e13c13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -91,7 +91,8 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal TaskInventoryDictionary Items { - get { + get + { return m_items; } set @@ -141,45 +142,53 @@ namespace OpenSim.Region.Framework.Scenes /// public void ResetInventoryIDs() { - if (null == m_part) - m_items.LockItemsForWrite(true); + if (m_part == null) + return; - if (Items.Count == 0) + m_items.LockItemsForWrite(true); + if (m_items.Count == 0) { m_items.LockItemsForWrite(false); return; } - IList items = new List(Items.Values); - Items.Clear(); + UUID partID = m_part.UUID; + IList items = new List(m_items.Values); + m_items.Clear(); foreach (TaskInventoryItem item in items) { - item.ResetIDs(m_part.UUID); - Items.Add(item.ItemID, item); + item.ResetIDs(partID); + m_items.Add(item.ItemID, item); } + m_inventorySerial++; m_items.LockItemsForWrite(false); } public void ResetObjectID() { + if (m_part == null) + return; + m_items.LockItemsForWrite(true); - if (Items.Count == 0) + if (m_items.Count == 0) { m_items.LockItemsForWrite(false); return; } - IList items = new List(Items.Values); - Items.Clear(); + IList items = new List(m_items.Values); + m_items.Clear(); + UUID partID = m_part.UUID; foreach (TaskInventoryItem item in items) { - item.ParentPartID = m_part.UUID; - item.ParentID = m_part.UUID; - Items.Add(item.ItemID, item); + item.ParentPartID = partID; + item.ParentID = partID; + m_items.Add(item.ItemID, item); } + m_inventorySerial++; m_items.LockItemsForWrite(false); } @@ -189,15 +198,17 @@ namespace OpenSim.Region.Framework.Scenes /// public void ChangeInventoryOwner(UUID ownerId) { - List items = GetInventoryItems(); - - if (items.Count == 0) + if(m_part == null) return; m_items.LockItemsForWrite(true); - HasInventoryChanged = true; - m_part.ParentGroup.HasGroupChanged = true; - foreach (TaskInventoryItem item in items) + if (m_items.Count == 0) + { + m_items.LockItemsForWrite(false); + return; + } + + foreach (TaskInventoryItem item in m_items.Values) { if (ownerId != item.OwnerID) item.LastOwnerID = item.OwnerID; @@ -207,6 +218,8 @@ namespace OpenSim.Region.Framework.Scenes item.PermsGranter = UUID.Zero; item.OwnerChanged = true; } + HasInventoryChanged = true; + m_part.ParentGroup.HasGroupChanged = true; m_inventorySerial++; m_items.LockItemsForWrite(false); } @@ -217,8 +230,11 @@ namespace OpenSim.Region.Framework.Scenes /// public void ChangeInventoryGroup(UUID groupID) { + if(m_part == null) + return; + m_items.LockItemsForWrite(true); - if (0 == Items.Count) + if (m_items.Count == 0) { m_items.LockItemsForWrite(false); return; @@ -233,11 +249,9 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.HasGroupChanged = true; } - IList items = new List(Items.Values); - foreach (TaskInventoryItem item in items) - { + foreach (TaskInventoryItem item in m_items.Values) item.GroupID = groupID; - } + m_items.LockItemsForWrite(false); } @@ -246,8 +260,8 @@ namespace OpenSim.Region.Framework.Scenes if (m_part == null || m_part.ParentGroup == null || m_part.ParentGroup.Scene == null) return; - Items.LockItemsForRead(true); - foreach (TaskInventoryItem item in Items.Values) + m_items.LockItemsForRead(true); + foreach (TaskInventoryItem item in m_items.Values) { if (item.InvType == (int)InventoryType.LSL) { @@ -257,7 +271,7 @@ namespace OpenSim.Region.Framework.Scenes } } - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); } public bool TryGetScriptInstanceRunning(UUID itemId, out bool running) @@ -345,7 +359,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void StopScriptInstances() { - GetInventoryItems(InventoryType.LSL).ForEach(i => StopScriptInstance(i)); + List scripts = GetInventoryItems(InventoryType.LSL); + foreach (TaskInventoryItem item in scripts) + StopScriptInstance(item); } /// @@ -807,7 +823,6 @@ namespace OpenSim.Region.Framework.Scenes m_part.AggregateInnerPerms(); m_inventorySerial++; - //m_inventorySerial += 2; HasInventoryChanged = true; m_part.ParentGroup.HasGroupChanged = true; } @@ -1126,18 +1141,18 @@ namespace OpenSim.Region.Framework.Scenes { bool changed = false; - Items.LockItemsForRead(true); + m_items.LockItemsForRead(true); if (m_inventorySerial == 0) // No inventory { - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); client.SendTaskInventory(m_part.UUID, 0, new byte[0]); return; } if (m_items.Count == 0) // No inventory { - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); client.SendTaskInventory(m_part.UUID, 0, new byte[0]); return; } @@ -1148,7 +1163,7 @@ namespace OpenSim.Region.Framework.Scenes changed = true; } - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); if (m_inventoryFileData.Length < 2) changed = true; @@ -1173,7 +1188,7 @@ namespace OpenSim.Region.Framework.Scenes InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); - Items.LockItemsForRead(true); + m_items.LockItemsForRead(true); foreach (TaskInventoryItem item in m_items.Values) { @@ -1234,7 +1249,7 @@ namespace OpenSim.Region.Framework.Scenes invString.AddSectionEnd(); } - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); m_inventoryFileData = Utils.StringToBytes(invString.GetString()); @@ -1264,10 +1279,10 @@ namespace OpenSim.Region.Framework.Scenes // of prim inventory loss. // if (HasInventoryChanged) // { - Items.LockItemsForRead(true); - ICollection itemsvalues = Items.Values; + m_items.LockItemsForRead(true); + ICollection itemsvalues = m_items.Values; HasInventoryChanged = false; - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); try { datastore.StorePrimInventory(m_part.UUID, itemsvalues); @@ -1434,15 +1449,13 @@ namespace OpenSim.Region.Framework.Scenes public int ScriptCount() { int count = 0; - Items.LockItemsForRead(true); + m_items.LockItemsForRead(true); foreach (TaskInventoryItem item in m_items.Values) { if (item.InvType == (int)InventoryType.LSL) - { count++; - } } - Items.LockItemsForRead(false); + m_items.LockItemsForRead(false); return count; } /// @@ -1465,9 +1478,7 @@ namespace OpenSim.Region.Framework.Scenes if (engine != null) { if (engine.GetScriptState(item.ItemID)) - { count++; - } } } } @@ -1476,37 +1487,35 @@ namespace OpenSim.Region.Framework.Scenes public List GetInventoryList() { - List ret = new List(); + m_items.LockItemsForRead(true); + List ret = new List(m_items.Count); foreach (TaskInventoryItem item in m_items.Values) ret.Add(item.ItemID); + m_items.LockItemsForRead(false); return ret; } public List GetInventoryItems() { - List ret = new List(); - - Items.LockItemsForRead(true); - ret = new List(m_items.Values); - Items.LockItemsForRead(false); + m_items.LockItemsForRead(true); + List ret = new List(m_items.Values); + m_items.LockItemsForRead(false); return ret; } public List GetInventoryItems(InventoryType type) { - List ret = new List(); - - Items.LockItemsForRead(true); + m_items.LockItemsForRead(true); + List ret = new List(m_items.Count); foreach (TaskInventoryItem item in m_items.Values) if (item.InvType == (int)type) ret.Add(item); - Items.LockItemsForRead(false); - + m_items.LockItemsForRead(false); return ret; } From 5bfe8b18fe47012530231a614c9123372afb4c03 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 8 Jun 2017 21:41:34 -0700 Subject: [PATCH 04/10] Another attempt at parsing MOAP elements in OAR files. Seems there are multiple interpretations of the format of the content of the element in OAR files. OpenSimulator (for reasons lost in the mist of time) escapes the XML in the element and then reparses it was a separate XmlReader. Other simulators fill the element with regular XML. This patch parses the escaped XML content as it always has and, if the parsing fails, falls back to trying to parse the pure XML. --- .../Serialization/SceneObjectSerializer.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 892403ba49..aa15422e17 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1361,7 +1361,28 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlReader reader) { - string value = reader.ReadElementContentAsString("Media", String.Empty); + string value = String.Empty; + try + { + // The prominant format for MOAP is escaped XML (with > etc). + // This is read as a string and passed to PrimitiveBaseShape which requires + // its XML as a string (which it parses with its own XmlReader). + value = reader.ReadElementContentAsString("Media", String.Empty); + } + catch (XmlException e) + { + // There are versions of OAR files that contain unquoted XML. + try + { + m_log.WarnFormat("[SERIALIZER] MOAP specification in non-escaped XML format. Recovering."); + value = reader.ReadInnerXml(); + } + catch (Exception ee) + { + m_log.ErrorFormat("[SERIALIZER] Failed parsing of MOAP information"); + throw new XmlException("Failed parsing of MOAP media XML element"); + } + } shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } From d12957dc2c3e649ea32da4c35a8eb997c404afce Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 12:14:13 +0100 Subject: [PATCH 05/10] still losing time with of halcyon incompatibile oars... cathch exceptions of the function that actually throws; Reduce log spam; don't let a broken MOAP stop all object deserialization. Fixing MOAP does not mean halcyon oars issues are fixed, just one. And really we should not even try to go against halcyon decison to be incompatible.(our MOAP encoding did not change since 2010) --- .../Scenes/Serialization/SceneObjectSerializer.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index aa15422e17..b012a088fd 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1364,26 +1364,24 @@ namespace OpenSim.Region.Framework.Scenes.Serialization string value = String.Empty; try { - // The prominant format for MOAP is escaped XML (with > etc). - // This is read as a string and passed to PrimitiveBaseShape which requires - // its XML as a string (which it parses with its own XmlReader). + // The STANDARD content of Media elemet is escaped XML string (with > etc). value = reader.ReadElementContentAsString("Media", String.Empty); + shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } catch (XmlException e) { // There are versions of OAR files that contain unquoted XML. + // ie ONE comercial fork that never wanted their oars to be read by our code try { - m_log.WarnFormat("[SERIALIZER] MOAP specification in non-escaped XML format. Recovering."); value = reader.ReadInnerXml(); + shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } - catch (Exception ee) + catch { - m_log.ErrorFormat("[SERIALIZER] Failed parsing of MOAP information"); - throw new XmlException("Failed parsing of MOAP media XML element"); + m_log.ErrorFormat("[SERIALIZER] Failed parsing halcyon MOAP information"); } } - shp.Media = PrimitiveBaseShape.MediaList.FromXml(value); } #endregion From 0ac6b74c5e8be67fe170991358bc098e8d38516c Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Mon, 22 May 2017 11:08:41 -0400 Subject: [PATCH 06/10] Fixed typo in log message --- OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs index 923e2ff8ba..a5ee2c9063 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEMeshWorker.cs @@ -936,7 +936,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde repData.actor.Name, asset.ID.ToString()); } else - m_log.WarnFormat("[PHYSICS]: asset provider returned null asset fo mesh of prim {0}.", + m_log.WarnFormat("[PHYSICS]: asset provider returned null asset for mesh of prim {0}.", repData.actor.Name); } } From 3cddfddc3f3aaa0e463e6fd8ddb87a0e2afff5b8 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Mon, 22 May 2017 11:10:39 -0400 Subject: [PATCH 07/10] Minor changes to commented text in bin/OpenSim.ini.example --- bin/OpenSim.ini.example | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index 5d969ce18c..543b7f8916 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -141,7 +141,7 @@ ;; The XML here has the same format as it does on the filesystem ;; (including the tag), except that everything is also enclosed ;; in a tag. - ; regionload_webserver_url = "http://example.com/regions.xml"; + ; regionload_webserver_url = "http://example.com/regions.xml" ;# {allow_regionless} {} {Allow simulator to start up with no regions configured.} {true false} false ;; Allow the simulator to start up if there are no region configuration available @@ -289,8 +289,8 @@ ;; SpawnPointRouting adjusts the landing for incoming avatars. ;; "closest" will place the avatar at the SpawnPoint located in the closest ;; available spot to the destination (typically map click/landmark). - ;; "random" will place the avatar on a randomly selected spawnpoint; - ;; "sequence" will place the avatar on the next sequential SpawnPoint + ;; "random" will place the avatar on a randomly selected spawnpoint. + ;; "sequence" will place the avatar on the next sequential SpawnPoint. ; SpawnPointRouting = closest ;# {TelehubAllowLandmark} {} {Allow users with landmarks to override telehub routing} {true false} false @@ -367,8 +367,8 @@ ; TexturePrimSize = 48 ;# {RenderMeshes} {} {Render meshes and sculpties on map tiles?} {true false} false - ;; Attempt to render meshes and sculpties on the map - ; RenderMeshes = false; + ;; Attempt to render meshes and sculpties on the map. + ; RenderMeshes = false [Permissions] @@ -550,7 +550,7 @@ ;; web server ; user_agent = "OpenSim LSL (Mozilla Compatible)" - ;; The follow 3 variables are for HTTP Basic Authentication for the Robust services. + ;; The following 3 variables are for HTTP Basic Authentication for the Robust services. ;; Use this if your central services in port 8003 need to be accessible on the Internet ;; but you want to protect them from unauthorized access. The username and password ;; here need to match the ones in the Robust service configuration. @@ -615,7 +615,6 @@ [SimulatorFeatures] - ;# {SearchServerURI} {} {URL of the search server} {} ;; Optional. If given this serves the same purpose as the grid wide ;; [LoginServices] SearchURL setting and will override that where @@ -672,7 +671,7 @@ ;; For standalones, this is the storage dll. ; StorageProvider = OpenSim.Data.MySQL.dll - ;# {MuteListModule} {OfflineMessageModule:OfflineMessageModule} {} {} MuteListModule + ;# {MuteListModule} {OfflineMessageModule:OfflineMessageModule} {} {} None ;; Mute list handler (not yet implemented). MUST BE SET to allow offline ;; messages to work ; MuteListModule = MuteListModule @@ -1128,7 +1127,7 @@ [MediaOnAPrim] ;# {Enabled} {} {Enable Media-on-a-Prim (MOAP)} {true false} true ;; Enable media on a prim facilities - ; Enabled = true; + ; Enabled = true [NPC] From f69e48bedca1e3aaae7ab0a1d681fccfe7af862f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 17:32:07 +0100 Subject: [PATCH 08/10] make SendCoarseLocations async, since it is http. Make some actions use thread from pool and not a new one. Threading does need a deep cleanup one of this days. This stops mantis 8183 warnings, but as side effect only --- .../CoreModules/Asset/FlotsamAssetCache.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 31 ++++++++++++------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index e5ac17d285..f2fc070c58 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -1168,7 +1168,7 @@ namespace OpenSim.Region.CoreModules.Asset con.Output("FloatSam Ensuring assets are cached for all scenes."); - WorkManager.RunInThread(delegate + WorkManager.RunInThreadPool(delegate { bool wasRunning= false; lock(timerLock) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e1e06d044d..ebef158311 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -394,6 +394,7 @@ namespace OpenSim.Region.Framework.Scenes /// asynchronously from the update loop. /// private bool m_cleaningTemps = false; + private bool m_sendingCoarseLocations = false; // same for async course locations sending /// /// Used to control main scene thread looping time when not updating via timer. @@ -1654,18 +1655,24 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_entitymovement == 0) m_sceneGraph.UpdateScenePresenceMovement(); - if (Frame % (m_update_coarse_locations) == 0) + if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations) { - List coarseLocations; - List avatarUUIDs; - - SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); - // Send coarse locations to clients - ForEachScenePresence(delegate(ScenePresence presence) - { - presence.SendCoarseLocations(coarseLocations, avatarUUIDs); - }); + m_sendingCoarseLocations = true; + WorkManager.RunInThreadPool( + delegate + { + List coarseLocations; + List avatarUUIDs; + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + m_sendingCoarseLocations = false; + }, null, string.Format("SendCoarseLocations ({0})", Name)); } + // Get the simulation frame time that the avatar force input // took tmpMS2 = Util.GetTimeStampMS(); @@ -1708,7 +1715,7 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) { m_cleaningTemps = true; - WorkManager.RunInThread( + WorkManager.RunInThreadPool( delegate { CleanTempObjects(); m_cleaningTemps = false; }, null, string.Format("CleanTempObjects ({0})", Name)); tmpMS2 = Util.GetTimeStampMS(); tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects @@ -1936,7 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_backingup) { m_backingup = true; - WorkManager.RunInThread(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); + WorkManager.RunInThreadPool(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); } } From e8165a7b51db74ea8d283dbfa34f21bf3d7a7552 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 20:14:56 +0100 Subject: [PATCH 09/10] only silent remove threads from watch list if they stopped ( ie still consider aborted etc ) --- OpenSim/Framework/Monitoring/Watchdog.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 5fb725c79a..9cac451c63 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -254,14 +254,12 @@ namespace OpenSim.Framework.Monitoring twi.Cleanup(); m_threads.Remove(threadID); - return true; } else { m_log.WarnFormat( "[WATCHDOG]: Requested to remove thread with ID {0} but this is not being monitored", threadID); - return false; } } @@ -360,7 +358,7 @@ namespace OpenSim.Framework.Monitoring List callbackInfos = null; List threadsToRemove = null; - const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested; + const ThreadState thgone = ThreadState.Stopped; lock (m_threads) { @@ -368,7 +366,7 @@ namespace OpenSim.Framework.Monitoring { if(!m_enabled) return; - if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0) + if((threadInfo.Thread.ThreadState & thgone) != 0) { if(threadsToRemove == null) threadsToRemove = new List(); From be975d1e89cbcb62f89cb7cb8367678a80cc47c6 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 23:27:33 +0100 Subject: [PATCH 10/10] add a adicional in transit flag to signal HG tps, and use it to ignore usernames requests sent to start region during tp; don't send unknows display names ( getdisplaynames cap ) --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 19 +++++++++++++++---- .../ClientStack/Linden/UDP/LLClientView.cs | 10 ++++++++-- .../EntityTransfer/EntityTransferModule.cs | 3 +++ .../UserManagement/UserManagementModule.cs | 1 + .../Framework/Scenes/SceneObjectGroup.cs | 1 + .../Region/Framework/Scenes/ScenePresence.cs | 5 +++++ 6 files changed, 33 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index e1b9e08f29..6f5775ad3d 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1577,7 +1577,10 @@ namespace OpenSim.Region.ClientStack.Linden break; m_Scene.TryGetScenePresence(m_AgentID, out sp); - if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit) + if(sp == null || sp.IsChildAgent || sp.IsDeleted) + break; + + if(sp.IsInTransit && !sp.IsInLocalTransit) break; client = sp.ControllingClient; @@ -1699,7 +1702,10 @@ namespace OpenSim.Region.ClientStack.Linden break; m_Scene.TryGetScenePresence(m_AgentID, out sp); - if(sp == null || sp.IsChildAgent || sp.IsDeleted || sp.IsInTransit) + if(sp == null || sp.IsChildAgent || sp.IsDeleted) + break; + + if(sp.IsInTransit && !sp.IsInLocalTransit) break; client = sp.ControllingClient; @@ -1807,7 +1813,7 @@ namespace OpenSim.Region.ClientStack.Linden if(sp == null || sp.IsDeleted) return ""; - if(sp.IsInTransit) + if(sp.IsInTransit && !sp.IsInLocalTransit) { httpResponse.StatusCode = (int)System.Net.HttpStatusCode.ServiceUnavailable; httpResponse.AddHeader("Retry-After","30"); @@ -1817,7 +1823,6 @@ namespace OpenSim.Region.ClientStack.Linden NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); string[] ids = query.GetValues("ids"); - Dictionary names = m_UserManager.GetUsersNames(ids); OSDMap osdReply = new OSDMap(); @@ -1833,12 +1838,18 @@ namespace OpenSim.Region.ClientStack.Linden string[] parts = kvp.Value.Split(new char[] {' '}); OSDMap osdname = new OSDMap(); + + // dont tell about unknown users, we can't send them back on Bad either + if(parts[0] == "Unknown") + continue; +/* if(parts[0] == "Unknown") { osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddHours(1)); osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddHours(2)); } else +*/ { osdname["display_name_next_update"] = OSD.FromDate(DateTime.UtcNow.AddDays(8)); osdname["display_name_expires"] = OSD.FromDate(DateTime.UtcNow.AddMonths(1)); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index f658a709af..1091078243 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -6473,8 +6473,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleUUIDGroupNameRequest(IClientAPI sender, Packet Pack) { - UUIDGroupNameRequestPacket upack = (UUIDGroupNameRequestPacket)Pack; + ScenePresence sp = (ScenePresence)SceneAgent; + if(sp == null || sp.IsDeleted || (sp.IsInTransit && !sp.IsInLocalTransit)) + return true; + UUIDGroupNameRequestPacket upack = (UUIDGroupNameRequestPacket)Pack; for (int i = 0; i < upack.UUIDNameBlock.Length; i++) { @@ -7493,7 +7496,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP SendUserInfoReply(false, true, ""); } return true; - } private bool HandleUpdateUserInfo(IClientAPI sender, Packet Pack) @@ -9648,6 +9650,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP private bool HandleUUIDNameRequest(IClientAPI sender, Packet Pack) { + ScenePresence sp = (ScenePresence)SceneAgent; + if(sp == null || sp.IsDeleted || (sp.IsInTransit && !sp.IsInLocalTransit)) + return true; + UUIDNameRequestPacket incoming = (UUIDNameRequestPacket)Pack; foreach (UUIDNameRequestPacket.UUIDNameBlockBlock UUIDBlock in incoming.UUIDNameBlock) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 99bebdd061..c93c54d5cf 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -771,8 +771,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer else if (sp.Flying) teleportFlags |= (uint)TeleportFlags.IsFlying; + sp.IsInLocalTransit = finalDestination.RegionLocY != 0; // HG sp.IsInTransit = true; + if (DisableInterRegionTeleportCancellation) teleportFlags |= (uint)TeleportFlags.DisableCancel; @@ -1524,6 +1526,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer public bool Cross(ScenePresence agent, bool isFlying) { + agent.IsInLocalTransit = true; agent.IsInTransit = true; CrossAsyncDelegate d = CrossAsync; d.BeginInvoke(agent, isFlying, CrossCompleted, d); diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 32cb5a383a..269546430f 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -175,6 +175,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement { client.OnNameFromUUIDRequest -= new UUIDNameRequest(HandleUUIDNameRequest); client.OnAvatarPickerRequest -= new AvatarPickerRequest(HandleAvatarPickerRequest); + client.OnConnectionClosed -= new Action(HandleConnectionClosed); } protected virtual void HandleUUIDNameRequest(UUID uuid, IClientAPI client) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 93c9b421aa..1695d9bd54 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -807,6 +807,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (avtocrossInfo avinfo in avsToCross) { ScenePresence av = avinfo.av; + av.IsInLocalTransit = true; av.IsInTransit = true; m_log.DebugFormat("[SCENE OBJECT]: Crossing avatar {0} to {1}", av.Name, val); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index daa9e504ee..47af3b88cb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -971,6 +971,10 @@ namespace OpenSim.Region.Framework.Scenes m_inTransit = value; } } + // this is is only valid if IsInTransit is true + // only false on HG tps + // used work arounf viewers asking source region about destination user + public bool IsInLocalTransit {get; set; } /// @@ -1040,6 +1044,7 @@ namespace OpenSim.Region.Framework.Scenes m_uuid = client.AgentId; LocalId = m_scene.AllocateLocalId(); LegacySitOffsets = m_scene.LegacySitOffsets; + IsInLocalTransit = true; UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid); if (account != null)