Close() the ScenePresence after we've removed it from the scene graph, to cut down race conditions when another thread manages the grab the presence after some SP structures have been reset.

0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-18 00:14:02 +01:00
parent 2f865da5c7
commit d5d801f218
1 changed files with 16 additions and 10 deletions

View File

@ -3279,24 +3279,30 @@ namespace OpenSim.Region.Framework.Scenes
if (AgentTransactionsModule != null) if (AgentTransactionsModule != null)
AgentTransactionsModule.RemoveAgentAssetTransactions(agentID); AgentTransactionsModule.RemoveAgentAssetTransactions(agentID);
avatar.Close();
m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode); m_authenticateHandler.RemoveCircuit(avatar.ControllingClient.CircuitCode);
} }
catch (Exception e) catch (Exception e)
{ {
m_log.Error( m_log.Error(
string.Format("[SCENE]: Exception removing {0} from {1}, ", avatar.Name, RegionInfo.RegionName), e); string.Format("[SCENE]: Exception removing {0} from {1}. Cleaning up. Exception ", avatar.Name, Name), e);
} }
finally finally
{ {
// Always clean these structures up so that any failure above doesn't cause them to remain in the try
// scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering {
// the same cleanup exception continually. // Always clean these structures up so that any failure above doesn't cause them to remain in the
// TODO: This should probably extend to the whole method, but we don't want to also catch the NRE // scene with possibly bad effects (e.g. continually timing out on unacked packets and triggering
// since this would hide the underlying failure and other associated problems. // the same cleanup exception continually.
m_sceneGraph.RemoveScenePresence(agentID); m_sceneGraph.RemoveScenePresence(agentID);
m_clientManager.Remove(agentID); m_clientManager.Remove(agentID);
avatar.Close();
}
catch (Exception e)
{
m_log.Error(
string.Format("[SCENE]: Exception in final clean up of {0} in {1}. Exception ", avatar.Name, Name), e);
}
} }
//m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false)); //m_log.InfoFormat("[SCENE] Memory pre GC {0}", System.GC.GetTotalMemory(false));