From adedd70c352581bc447452f5835c10853c77bea8 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 10 Feb 2013 13:01:33 -0500 Subject: [PATCH 1/4] Fix teleport/telehub issue: Fix bug that allowed only login access to regions with mis-configured telehubs. Administrators now have teleport access when there exists a mis-configured telehub in the region. Estate owners are now placed at region center in the absence of spawnpoints instead of being denied access. Grid Gods are unrestricted. All others are denied access to the region until spawnpoints are assigned to the telehub object. --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 11 ++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index de3978c4db..9b17b7f650 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5506,8 +5506,13 @@ namespace OpenSim.Region.Framework.Scenes if (banned) { - reason = "No suitable landing point found"; - return false; + if(Permissions.IsAdministrator(agentID) == false || Permissions.IsGridGod(agentID) == false) + { + reason = "No suitable landing point found"; + return false; + } + reason = "Administrative access only"; + return true; } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6e41774bcf..30bd715f2b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4021,6 +4021,7 @@ namespace OpenSim.Region.Framework.Scenes (m_teleportFlags & TeleportFlags.ViaLocation) != 0 || (m_teleportFlags & Constants.TeleportFlags.ViaHGLogin) != 0) { + if (GodLevel < 200 && ((!m_scene.Permissions.IsGod(m_uuid) && !m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) || @@ -4029,7 +4030,14 @@ namespace OpenSim.Region.Framework.Scenes { SpawnPoint[] spawnPoints = m_scene.RegionInfo.RegionSettings.SpawnPoints().ToArray(); if (spawnPoints.Length == 0) + { + if(m_scene.RegionInfo.EstateSettings.IsEstateManagerOrOwner(m_uuid)) + { + pos.X = 128.0f; + pos.Y = 128.0f; + } return; + } int index; bool selected = false; @@ -4049,7 +4057,8 @@ namespace OpenSim.Region.Framework.Scenes // SpawnPoint sp = spawnPoints[index]; ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); - if (land == null || land.IsEitherBannedOrRestricted(UUID)) + if (spawnPoints.Length == 0) + return; if (land == null || land.IsEitherBannedOrRestricted(UUID)) selected = false; else selected = true; From 7524bd5a7ce332a9c63587423c79d6988e4c2896 Mon Sep 17 00:00:00 2001 From: Allen Kerensky Date: Sat, 9 Feb 2013 15:06:42 -0600 Subject: [PATCH 2/4] Additional ThreadPool worker and IOCP thread startup logic Signed-off-by: BlueWall --- OpenSim/Region/Application/Application.cs | 45 ++++++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index 0f90d37107..c3e7ec2e67 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs @@ -102,17 +102,50 @@ namespace OpenSim m_log.InfoFormat( "[OPENSIM MAIN]: Environment variable MONO_THREADS_PER_CPU is {0}", monoThreadsPerCpu ?? "unset"); - // Increase the number of IOCP threads available. Mono defaults to a tragically low number + // Verify the Threadpool allocates or uses enough worker and IO completion threads + // .NET 2.0 workerthreads default to 50 * numcores + // .NET 3.0 workerthreads defaults to 250 * numcores + // .NET 4.0 workerthreads are dynamic based on bitness and OS resources + // Max IO Completion threads are 1000 on all 3 CLRs. + int workerThreadsMin = 500; + int workerThreadsMax = 1000; // may need further adjustment to match other CLR + int iocpThreadsMin = 1000; + int iocpThreadsMax = 2000; // may need further adjustment to match other CLR int workerThreads, iocpThreads; System.Threading.ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); m_log.InfoFormat("[OPENSIM MAIN]: Runtime gave us {0} worker threads and {1} IOCP threads", workerThreads, iocpThreads); - if (workerThreads < 500 || iocpThreads < 1000) + if (workerThreads < workerThreadsMin) { - workerThreads = 500; - iocpThreads = 1000; - m_log.Info("[OPENSIM MAIN]: Bumping up to 500 worker threads and 1000 IOCP threads"); - System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads); + workerThreads = workerThreadsMin; + m_log.InfoFormat("[OPENSIM MAIN]: Bumping up to worker threads to {0}",workerThreads); } + if (workerThreads > workerThreadsMax) + { + workerThreads = workerThreadsMax; + m_log.InfoFormat("[OPENSIM MAIN]: Limiting worker threads to {0}",workerThreads); + } + // Increase the number of IOCP threads available. + // Mono defaults to a tragically low number (24 on 6-core / 8GB Fedora 17) + if (iocpThreads < iocpThreadsMin) + { + iocpThreads = iocpThreadsMin; + m_log.InfoFormat("[OPENSIM MAIN]: Bumping up IO completion threads to {0}",iocpThreads); + } + // Make sure we don't overallocate IOCP threads and thrash system resources + if ( iocpThreads > iocpThreadsMax ) + { + iocpThreads = iocpThreadsMax; + m_log.InfoFormat("[OPENSIM MAIN]: Limiting IO completion threads to {0}",iocpThreads); + } + // set the resulting worker and IO completion thread counts back to ThreadPool + if ( System.Threading.ThreadPool.SetMaxThreads(workerThreads, iocpThreads) ) + { + m_log.InfoFormat("[OPENSIM MAIN]: Threadpool set to {0} worker threads and {1} IO completion threads", workerThreads, iocpThreads); + } + else + { + m_log.Info("[OPENSIM MAIN]: Threadpool reconfiguration failed, runtime defaults still in effect."); + } // Check if the system is compatible with OpenSimulator. // Ensures that the minimum system requirements are met From 38b476d9d638af1c6fd55ec78a051d6130ae9398 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 10 Feb 2013 14:17:02 -0500 Subject: [PATCH 3/4] Adding contributor to credits: Welcome Allen Kerensky! --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 43dea0bd3b..5e50903d7f 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -65,6 +65,7 @@ what it is today. * A_Biondi * alex_carnell * Alan Webb (IBM) +* Allen Kerensky * BigFootAg * BlueWall Slade * brianw/Sir_Ahzz From 6f3dcf58b8f47922b68993cfdd9cdbd5b4ae36d8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 10 Feb 2013 20:00:39 +0000 Subject: [PATCH 4/4] Fix code to check for no spawn points. Possibly a merge artefact? --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 30bd715f2b..70e3952405 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -4046,6 +4046,8 @@ namespace OpenSim.Region.Framework.Scenes { case "random": + if (spawnPoints.Length == 0) + return; do { index = Util.RandomClass.Next(spawnPoints.Length - 1); @@ -4057,8 +4059,8 @@ namespace OpenSim.Region.Framework.Scenes // SpawnPoint sp = spawnPoints[index]; ILandObject land = m_scene.LandChannel.GetLandObject(spawnPosition.X, spawnPosition.Y); - if (spawnPoints.Length == 0) - return; if (land == null || land.IsEitherBannedOrRestricted(UUID)) + + if (land == null || land.IsEitherBannedOrRestricted(UUID)) selected = false; else selected = true;