aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs13
-rw-r--r--OpenSim/Region/Application/OpenSim.cs2
2 files changed, 10 insertions, 5 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index 8a4894e..5fb725c 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -193,7 +193,7 @@ namespace OpenSim.Framework.Monitoring
193 m_watchdogTimer.Dispose(); 193 m_watchdogTimer.Dispose();
194 m_watchdogTimer = null; 194 m_watchdogTimer = null;
195 } 195 }
196 196
197 foreach(ThreadWatchdogInfo twi in m_threads.Values) 197 foreach(ThreadWatchdogInfo twi in m_threads.Values)
198 { 198 {
199 Thread t = twi.Thread; 199 Thread t = twi.Thread;
@@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring
341 /// <param name="e"></param> 341 /// <param name="e"></param>
342 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) 342 private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
343 { 343 {
344 if(!m_enabled)
345 return;
344 int now = Environment.TickCount & Int32.MaxValue; 346 int now = Environment.TickCount & Int32.MaxValue;
345 int msElapsed = now - LastWatchdogThreadTick; 347 int msElapsed = now - LastWatchdogThreadTick;
346 348
@@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring
358 List<ThreadWatchdogInfo> callbackInfos = null; 360 List<ThreadWatchdogInfo> callbackInfos = null;
359 List<ThreadWatchdogInfo> threadsToRemove = null; 361 List<ThreadWatchdogInfo> threadsToRemove = null;
360 362
363 const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested;
364
361 lock (m_threads) 365 lock (m_threads)
362 { 366 {
363 foreach(ThreadWatchdogInfo threadInfo in m_threads.Values) 367 foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
364 { 368 {
365 if(threadInfo.Thread.ThreadState == ThreadState.Stopped) 369 if(!m_enabled)
370 return;
371 if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0)
366 { 372 {
367 if(threadsToRemove == null) 373 if(threadsToRemove == null)
368 threadsToRemove = new List<ThreadWatchdogInfo>(); 374 threadsToRemove = new List<ThreadWatchdogInfo>();
369 375
370 threadsToRemove.Add(threadInfo); 376 threadsToRemove.Add(threadInfo);
371 377/*
372 if(callbackInfos == null) 378 if(callbackInfos == null)
373 callbackInfos = new List<ThreadWatchdogInfo>(); 379 callbackInfos = new List<ThreadWatchdogInfo>();
374 380
375 callbackInfos.Add(threadInfo); 381 callbackInfos.Add(threadInfo);
382*/
376 } 383 }
377 else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) 384 else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
378 { 385 {
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index 5977f40..fcc8717 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -511,8 +511,6 @@ namespace OpenSim
511 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi) 511 private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
512 { 512 {
513 int now = Environment.TickCount & Int32.MaxValue; 513 int now = Environment.TickCount & Int32.MaxValue;
514 if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped)
515 return;
516 m_log.ErrorFormat( 514 m_log.ErrorFormat(
517 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}", 515 "[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
518 twi.Thread.Name, 516 twi.Thread.Name,