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;
}
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>
/// Add a thread to the watchdog tracker.
/// </summary>

View File

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

View File

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

View File

@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Watchdog.UpdateThread();
}
catch ( System.Threading.ThreadAbortException) { }
catch (Exception 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);
}
}
catch (System.Threading.ThreadAbortException) { }
catch (Exception e)
{
m_log.Error(

View File

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