From e4e5237086bd34a6649b687d3499a6795317f043 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Aug 2012 00:46:34 +0100 Subject: When reporting a thread timeout, create a copy of the info rather than passing the original ThreadWatchdogInfo structure. This is to avoid the possibility of misleading reporting if a watchdog update outraces an alarm. Should address any remaining issues from http://opensimulator.org/mantis/view.php?id=6012 --- OpenSim/Framework/Monitoring/Watchdog.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Monitoring/Watchdog.cs') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 02f11fa..7964f28 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -89,6 +89,17 @@ namespace OpenSim.Framework.Monitoring FirstTick = Environment.TickCount & Int32.MaxValue; LastTick = FirstTick; } + + public ThreadWatchdogInfo(ThreadWatchdogInfo previousTwi) + { + Thread = previousTwi.Thread; + FirstTick = previousTwi.FirstTick; + LastTick = previousTwi.LastTick; + Timeout = previousTwi.Timeout; + IsTimedOut = previousTwi.IsTimedOut; + AlarmIfTimeout = previousTwi.AlarmIfTimeout; + AlarmMethod = previousTwi.AlarmMethod; + } } /// @@ -335,7 +346,9 @@ namespace OpenSim.Framework.Monitoring if (callbackInfos == null) callbackInfos = new List(); - callbackInfos.Add(threadInfo); + // Send a copy of the watchdog info to prevent race conditions where the watchdog + // thread updates the monitoring info after an alarm has been sent out. + callbackInfos.Add(new ThreadWatchdogInfo(threadInfo)); } } } -- cgit v1.1 From ab7b7c5d3df03decbcaa3b8bf7683f1268f2be92 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 12 Oct 2012 02:59:28 +0100 Subject: Get Watchdog to log thread removal --- OpenSim/Framework/Monitoring/Watchdog.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Monitoring/Watchdog.cs') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index 7964f28..a20326d 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -231,7 +231,25 @@ namespace OpenSim.Framework.Monitoring private static bool RemoveThread(int threadID) { lock (m_threads) - return m_threads.Remove(threadID); + { + ThreadWatchdogInfo twi; + if (m_threads.TryGetValue(threadID, out twi)) + { + m_log.DebugFormat( + "[WATCHDOG]: Removing thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); + + 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; + } + } } public static bool AbortThread(int threadID) -- cgit v1.1 From cd088757e96217defc9a2b0bf323747615c3255e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Nov 2012 04:36:22 +0000 Subject: Add a first draft mechanism for the IncomingPacketsProcessedStat to show the delta over time. The chief motivation for this is to be able to tell whether there's any impact on incoming packet processing from enabling extra packet pooling. --- OpenSim/Framework/Monitoring/Watchdog.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Monitoring/Watchdog.cs') diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs index a20326d..3f992b1 100644 --- a/OpenSim/Framework/Monitoring/Watchdog.cs +++ b/OpenSim/Framework/Monitoring/Watchdog.cs @@ -39,7 +39,7 @@ namespace OpenSim.Framework.Monitoring public static class Watchdog { /// Timer interval in milliseconds for the watchdog timer - const double WATCHDOG_INTERVAL_MS = 2500.0d; + public const double WATCHDOG_INTERVAL_MS = 2500.0d; /// Default timeout in milliseconds before a thread is considered dead public const int DEFAULT_WATCHDOG_TIMEOUT_MS = 5000; @@ -380,6 +380,8 @@ namespace OpenSim.Framework.Monitoring if (MemoryWatchdog.Enabled) MemoryWatchdog.Update(); + StatsManager.RecordStats(); + m_watchdogTimer.Start(); } } -- cgit v1.1