Add Thread.ResetAbort() to various thread loops to clean up errors on
shutdown. Fixes Mantis #8494. Threads are aborted when shutting down and ThreadAbortException is odd in that it is rethrown at the end of the catch unless the abort is reset. No functional changes but fewer error messages on shutdown.0.9.1.0-post-fixes
parent
9e182c27fb
commit
bd1b992aaf
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Contributors, http://opensimulator.org/
|
* Copyright (c) Contributors, http://opensimulator.org/
|
||||||
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
* See CONTRIBUTORS.TXT for a full list of copyright holders.
|
||||||
*
|
*
|
||||||
|
@ -229,9 +229,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
PollServiceHttpRequest req;
|
PollServiceHttpRequest req;
|
||||||
while (m_running)
|
while (m_running)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
req = null;
|
req = null;
|
||||||
if(!m_requests.TryTake(out req, 4500) || req == null)
|
if (!m_requests.TryTake(out req, 4500) || req == null)
|
||||||
{
|
{
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
continue;
|
continue;
|
||||||
|
@ -239,16 +241,14 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
|
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
|
|
||||||
try
|
if (!req.HttpContext.CanSend())
|
||||||
{
|
|
||||||
if(!req.HttpContext.CanSend())
|
|
||||||
{
|
{
|
||||||
req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id);
|
req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id);
|
||||||
byContextDequeue(req);
|
byContextDequeue(req);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(req.HttpContext.IsSending())
|
if (req.HttpContext.IsSending())
|
||||||
{
|
{
|
||||||
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms)
|
||||||
{
|
{
|
||||||
|
@ -290,7 +290,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
{
|
{
|
||||||
nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id));
|
nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id));
|
||||||
}
|
}
|
||||||
catch (ObjectDisposedException) {}
|
catch (ObjectDisposedException) { }
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
byContextDequeue(nreq);
|
byContextDequeue(nreq);
|
||||||
|
@ -305,6 +305,12 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
Thread.ResetAbort();
|
||||||
|
// Shouldn't set this to 'false', the normal shutdown should cause things to exit
|
||||||
|
// m_running = false;
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
|
m_log.ErrorFormat("Exception in poll service thread: " + e.ToString());
|
||||||
|
|
|
@ -203,11 +203,13 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private static void DoAssetRequests()
|
private static void DoAssetRequests()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
while (m_NumberScenes > 0)
|
while (m_NumberScenes > 0)
|
||||||
{
|
{
|
||||||
APollRequest poolreq;
|
APollRequest poolreq;
|
||||||
if(m_queue.TryTake(out poolreq, 4500))
|
if (m_queue.TryTake(out poolreq, 4500))
|
||||||
{
|
{
|
||||||
if (m_NumberScenes <= 0)
|
if (m_NumberScenes <= 0)
|
||||||
break;
|
break;
|
||||||
|
@ -219,6 +221,11 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
Thread.ResetAbort();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class PollServiceAssetEventArgs : PollServiceEventArgs
|
private class PollServiceAssetEventArgs : PollServiceEventArgs
|
||||||
{
|
{
|
||||||
|
|
|
@ -395,7 +395,10 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
private static void DoInventoryRequests()
|
private static void DoInventoryRequests()
|
||||||
{
|
{
|
||||||
while (true)
|
bool running = true;
|
||||||
|
while (running)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
APollRequest poolreq;
|
APollRequest poolreq;
|
||||||
if (m_queue.TryTake(out poolreq, 4500))
|
if (m_queue.TryTake(out poolreq, 4500))
|
||||||
|
@ -407,6 +410,12 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
}
|
}
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
Thread.ResetAbort();
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1910,7 +1910,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
incomingPacket = null;
|
incomingPacket = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch (ThreadAbortException)
|
||||||
|
{
|
||||||
|
Thread.ResetAbort();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
m_log.Error("[LLUDPSERVER]: Error in the incoming packet handler loop: " + ex.Message, ex);
|
||||||
}
|
}
|
||||||
|
|
9
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
Normal file → Executable file
9
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs
Normal file → Executable file
|
@ -221,7 +221,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static void CmdHandlerThreadLoop()
|
private static void CmdHandlerThreadLoop()
|
||||||
{
|
{
|
||||||
while (true)
|
bool running = true;
|
||||||
|
while (running)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -230,7 +231,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
DoOneCmdHandlerPass();
|
DoOneCmdHandlerPass();
|
||||||
Watchdog.UpdateThread();
|
Watchdog.UpdateThread();
|
||||||
}
|
}
|
||||||
catch ( System.Threading.ThreadAbortException) { }
|
catch ( System.Threading.ThreadAbortException)
|
||||||
|
{
|
||||||
|
Thread.ResetAbort();
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue