* Practise some defensive programming - gracefully terminate the thread if there is a problm in the world map module rather than bringing down the whole server.

0.6.0-stable
Justin Clarke Casey 2008-11-04 20:23:18 +00:00
parent 21c0df53a2
commit 97d320d7d1
2 changed files with 30 additions and 22 deletions

View File

@ -390,32 +390,40 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
/// </summary> /// </summary>
public void process() public void process()
{ {
while (true) try
{ {
MapRequestState st = requests.Dequeue(); while (true)
// end gracefully
if (st.agentID == UUID.Zero)
{ {
ThreadTracker.Remove(mapItemReqThread); MapRequestState st = requests.Dequeue();
break;
}
bool dorequest = true; // end gracefully
lock (m_rootAgents) if (st.agentID == UUID.Zero)
{ {
if (!m_rootAgents.Contains(st.agentID)) ThreadTracker.Remove(mapItemReqThread);
dorequest = false; break;
} }
if (dorequest) bool dorequest = true;
{ lock (m_rootAgents)
LLSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); {
RequestMapItemsCompleted(response); if (!m_rootAgents.Contains(st.agentID))
dorequest = false;
}
if (dorequest)
{
LLSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle);
RequestMapItemsCompleted(response);
}
} }
} }
catch (Exception e)
{
m_log.ErrorFormat("[WorldMap]: Map item request thread terminated abnormally with exception {0}", e);
}
threadrunning = false; threadrunning = false;
m_log.Warn("[WorldMap]: Remote request thread exiting"); m_log.Debug("[WorldMap]: Remote request thread exiting");
} }
/// <summary> /// <summary>

View File

@ -17,7 +17,7 @@
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARThY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
@ -203,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
catch (Exception e) catch (Exception e)
{ {
if (lastScriptEngine != null) if (lastScriptEngine != null)
lastScriptEngine.Log.WarnFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString()); lastScriptEngine.Log.ErrorFormat("[{0}]: Exception {1} thrown", ScriptEngineName, e.GetType().ToString());
throw e; throw e;
} }
} }