move assetsconnector threads to whatchdog; Abort all alive threads known to watchdog before exit

0.9.0-post-fixes
UbitUmarov 2017-05-25 06:05:02 +01:00
parent 0d31898fd6
commit 772c5b7db0
6 changed files with 30 additions and 2 deletions

View File

@ -180,6 +180,30 @@ namespace OpenSim.Framework.Monitoring
m_watchdogTimer.Elapsed += WatchdogTimerElapsed; m_watchdogTimer.Elapsed += WatchdogTimerElapsed;
} }
public static void Stop()
{
if(m_threads == null)
return;
lock(m_threads)
{
m_enabled = false;
if(m_watchdogTimer != null)
{
m_watchdogTimer.Dispose();
m_watchdogTimer = null;
}
foreach(ThreadWatchdogInfo twi in m_threads.Values)
{
Thread t = twi.Thread;
if(t.IsAlive)
t.Abort();
}
m_threads.Clear();
}
}
/// <summary> /// <summary>
/// Add a thread to the watchdog tracker. /// Add a thread to the watchdog tracker.
/// </summary> /// </summary>

View File

@ -85,6 +85,7 @@ namespace OpenSim.Framework.Monitoring
public static void Stop() public static void Stop()
{ {
JobEngine.Stop(); JobEngine.Stop();
Watchdog.Stop();
} }
/// <summary> /// <summary>

View File

@ -119,6 +119,7 @@ namespace OpenSim.Framework.Servers
Thread.Sleep(1000); Thread.Sleep(1000);
RemovePIDFile(); RemovePIDFile();
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting..."); m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");
if (!SuppressExit) if (!SuppressExit)

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Watchdog.UpdateThread(); Watchdog.UpdateThread();
} }
catch ( System.Threading.ThreadAbortException) { }
catch (Exception e) catch (Exception e)
{ {
m_log.Error("[ASYNC COMMAND MANAGER]: Exception in command handler pass: ", e); m_log.Error("[ASYNC COMMAND MANAGER]: Exception in command handler pass: ", e);

View File

@ -1079,6 +1079,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
"[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name);
} }
} }
catch (System.Threading.ThreadAbortException) { }
catch (Exception e) catch (Exception e)
{ {
m_log.Error( m_log.Error(

View File

@ -252,7 +252,7 @@ namespace OpenSim.Server.Base
MemoryWatchdog.Enabled = false; MemoryWatchdog.Enabled = false;
Watchdog.Enabled = false; Watchdog.Enabled = false;
WorkManager.Stop();
RemovePIDFile(); RemovePIDFile();
return 0; return 0;