From e36a54ee2ab7b9e8f9c9170610a942c261eb270c Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Mon, 5 Oct 2009 20:39:23 -0700
Subject: #if DEBBUG code for monitoring the ThreadPool.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 606135b..35e57e5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -962,6 +962,13 @@ namespace OpenSim.Region.Framework.Scenes
int maintc = 0;
while (!shuttingdown)
{
+#if DEBUG
+ int w = 0, io = 0, maxw=0, maxio=0;
+ ThreadPool.GetAvailableThreads(out w, out io);
+ ThreadPool.GetMaxThreads(out maxw, out maxio);
+ if ((maxw - w < 10) || (maxio - io < 10))
+ m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}({1}); io = {2}({3})", w, io, maxw, maxio);
+#endif
maintc = Environment.TickCount;
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
--
cgit v1.1
From 0c46df973ad08381a7fcdb892e4525dfdb1d6ee4 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Mon, 5 Oct 2009 21:02:10 -0700
Subject: Correction on the DEBUG code.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 35e57e5..d0dc021 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -963,11 +963,10 @@ namespace OpenSim.Region.Framework.Scenes
while (!shuttingdown)
{
#if DEBUG
- int w = 0, io = 0, maxw=0, maxio=0;
+ int w = 0, io = 0;
ThreadPool.GetAvailableThreads(out w, out io);
- ThreadPool.GetMaxThreads(out maxw, out maxio);
- if ((maxw - w < 10) || (maxio - io < 10))
- m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}({1}); io = {2}({3})", w, io, maxw, maxio);
+ if ((w < 10) || (io < 10))
+ m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
#endif
maintc = Environment.TickCount;
--
cgit v1.1
From 2a060136bd89174a3071de9458c25af133c01b64 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 6 Oct 2009 15:28:38 +0100
Subject: Lock the heartbeat against multiple invocations. May prevent
deadlocks and/or runaway thread use
---
OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d0dc021..c863c3b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,6 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
protected IAssetService m_AssetService = null;
protected IAuthorizationService m_AuthorizationService = null;
+ private Object m_heartbeatLock = new Object();
+
public IAssetService AssetService
{
get
@@ -942,6 +944,9 @@ namespace OpenSim.Region.Framework.Scenes
///
private void Heartbeat(object sender)
{
+ if (!Monitor.TryEnter(m_heartbeatLock))
+ return;
+
try
{
Update();
@@ -952,6 +957,11 @@ namespace OpenSim.Region.Framework.Scenes
catch (ThreadAbortException)
{
}
+ finally
+ {
+ Monitor.Pulse(m_heartbeatLock);
+ Monitor.Exit(m_heartbeatLock);
+ }
}
///
--
cgit v1.1
From d4d060b57d380c9a19536bde79013b7634dbdf83 Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Tue, 6 Oct 2009 07:49:05 -0700
Subject: Commenting the DEBUG code that I added yesterday, because it's
causing mono to fail with https://bugzilla.novell.com/show_bug.cgi?id=538854
---
OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d0dc021..df9b163 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -962,12 +962,12 @@ namespace OpenSim.Region.Framework.Scenes
int maintc = 0;
while (!shuttingdown)
{
-#if DEBUG
- int w = 0, io = 0;
- ThreadPool.GetAvailableThreads(out w, out io);
- if ((w < 10) || (io < 10))
- m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
-#endif
+//#if DEBUG
+// int w = 0, io = 0;
+// ThreadPool.GetAvailableThreads(out w, out io);
+// if ((w < 10) || (io < 10))
+// m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io);
+//#endif
maintc = Environment.TickCount;
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
--
cgit v1.1