Don't enable the thread watchdog until all regions are ready.
This is to avoid false positives when the machine is under heavy load whilst starting up.integration
							parent
							
								
									7679384829
								
							
						
					
					
						commit
						5a1b6fdf06
					
				| 
						 | 
				
			
			@ -97,6 +97,32 @@ namespace OpenSim.Framework.Monitoring
 | 
			
		|||
        /// /summary>
 | 
			
		||||
        public static event Action<ThreadWatchdogInfo> OnWatchdogTimeout;
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Is this watchdog active?
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public static bool Enabled
 | 
			
		||||
        {
 | 
			
		||||
            get { return m_enabled; }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
//                m_log.DebugFormat("[MEMORY WATCHDOG]: Setting MemoryWatchdog.Enabled to {0}", value);
 | 
			
		||||
 | 
			
		||||
                if (value == m_enabled)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                m_enabled = value;
 | 
			
		||||
 | 
			
		||||
                if (m_enabled)
 | 
			
		||||
                {
 | 
			
		||||
                    // Set now so we don't get alerted on the first run
 | 
			
		||||
                    LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                m_watchdogTimer.Enabled = m_enabled;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        private static bool m_enabled;
 | 
			
		||||
 | 
			
		||||
        private static readonly ILog m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 | 
			
		||||
        private static Dictionary<int, ThreadWatchdogInfo> m_threads;
 | 
			
		||||
        private static System.Timers.Timer m_watchdogTimer;
 | 
			
		||||
| 
						 | 
				
			
			@ -115,11 +141,6 @@ namespace OpenSim.Framework.Monitoring
 | 
			
		|||
            m_watchdogTimer = new System.Timers.Timer(WATCHDOG_INTERVAL_MS);
 | 
			
		||||
            m_watchdogTimer.AutoReset = false;
 | 
			
		||||
            m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
 | 
			
		||||
 | 
			
		||||
            // Set now so we don't get alerted on the first run
 | 
			
		||||
            LastWatchdogThreadTick = Environment.TickCount & Int32.MaxValue;
 | 
			
		||||
 | 
			
		||||
            m_watchdogTimer.Start();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -305,8 +305,13 @@ namespace OpenSim
 | 
			
		|||
            m_httpServerPort = m_networkServersInfo.HttpListenerPort;
 | 
			
		||||
            SceneManager.OnRestartSim += handleRestartRegion;
 | 
			
		||||
 | 
			
		||||
            // Only start the memory watchdog once all regions are ready
 | 
			
		||||
            SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady;
 | 
			
		||||
            // Only enable the watchdogs when all regions are ready.  Otherwise we get false positives when cpu is
 | 
			
		||||
            // heavily used during initial startup.
 | 
			
		||||
            //
 | 
			
		||||
            // FIXME: It's also possible that region ready status should be flipped during an OAR load since this
 | 
			
		||||
            // also makes heavy use of the CPU.
 | 
			
		||||
            SceneManager.OnRegionsReadyStatusChange
 | 
			
		||||
                += sm => { MemoryWatchdog.Enabled = sm.AllRegionsReady; Watchdog.Enabled = sm.AllRegionsReady; };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue