change wrong watchdog stopped thread check code, and don't log it

0.9.0-post-fixes
UbitUmarov 2017-05-26 00:05:35 +01:00
parent 31b4a31246
commit d90b68c2a6
2 changed files with 10 additions and 5 deletions

View File

@ -341,6 +341,8 @@ namespace OpenSim.Framework.Monitoring
/// <param name="e"></param>
private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if(!m_enabled)
return;
int now = Environment.TickCount & Int32.MaxValue;
int msElapsed = now - LastWatchdogThreadTick;
@ -358,21 +360,26 @@ namespace OpenSim.Framework.Monitoring
List<ThreadWatchdogInfo> callbackInfos = null;
List<ThreadWatchdogInfo> threadsToRemove = null;
const ThreadState thgone = ThreadState.Stopped | ThreadState.Aborted | ThreadState.AbortRequested;
lock (m_threads)
{
foreach(ThreadWatchdogInfo threadInfo in m_threads.Values)
{
if(threadInfo.Thread.ThreadState == ThreadState.Stopped)
if(!m_enabled)
return;
if(!threadInfo.Thread.IsAlive || (threadInfo.Thread.ThreadState & thgone) != 0)
{
if(threadsToRemove == null)
threadsToRemove = new List<ThreadWatchdogInfo>();
threadsToRemove.Add(threadInfo);
/*
if(callbackInfos == null)
callbackInfos = new List<ThreadWatchdogInfo>();
callbackInfos.Add(threadInfo);
*/
}
else if(!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout)
{

View File

@ -511,8 +511,6 @@ namespace OpenSim
private void WatchdogTimeoutHandler(Watchdog.ThreadWatchdogInfo twi)
{
int now = Environment.TickCount & Int32.MaxValue;
if(twi.Thread.ThreadState == System.Threading.ThreadState.Stopped)
return;
m_log.ErrorFormat(
"[WATCHDOG]: Timeout detected for thread \"{0}\". ThreadState={1}. Last tick was {2}ms ago. {3}",
twi.Thread.Name,