* Restaring the sim works fine in grid mode now. Sims announce themselves to their neighbors when they start up. Neighbors get this message and tell their agents that there's a new sim up.

* Certain unrecoverable physics based crashes in ODE are now hooked up to the 'restart the sim' routine.
This commit is contained in:
Teravus Ovares
2007-11-28 06:18:07 +00:00
parent f3895c1e01
commit b7d596a6af
13 changed files with 354 additions and 47 deletions

View File

@@ -11,8 +11,14 @@ using OpenSim.Region.Physics.Manager;
namespace OpenSim.Region.Environment.Scenes
{
public delegate void PhysicsCrash();
public class InnerScene
{
#region Events
public event PhysicsCrash UnRecoverableError;
#endregion
#region Fields
public Dictionary<LLUUID, ScenePresence> ScenePresences;
public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
@@ -26,17 +32,47 @@ namespace OpenSim.Region.Environment.Scenes
internal object m_syncRoot = new object();
public PhysicsScene PhyScene;
public PhysicsScene _PhyScene;
#endregion
public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
{
m_parentScene = parent;
m_regInfo = regInfo;
PermissionsMngr = permissionsMngr;
QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256);
QuadTree.Subdivide();
QuadTree.Subdivide();
}
public PhysicsScene PhyScene
{
get
{ return _PhyScene; }
set
{
// If we're not doing the initial set
// Then we've got to remove the previous
// event handler
try
{
_PhyScene.OnPhysicsCrash -= physicsBasedCrash;
}
catch (System.NullReferenceException)
{
// This occurs when storing to _PhyScene the first time.
// Is there a better way to check the event handler before
// getting here
// This can be safely ignored. We're setting the first inital
// there are no event handler's registered.
}
_PhyScene = value;
_PhyScene.OnPhysicsCrash += physicsBasedCrash;
}
}
public void Close()
@@ -55,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
// PhysX does this (runs in the background).
if (PhyScene.IsThreaded)
if (_PhyScene.IsThreaded)
{
PhyScene.GetResults();
_PhyScene.GetResults();
}
}
@@ -75,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes
{
lock (m_syncRoot)
{
PhyScene.Simulate((float)elapsed);
_PhyScene.Simulate((float)elapsed);
}
}
@@ -338,6 +374,15 @@ namespace OpenSim.Region.Environment.Scenes
#region Other Methods
public void physicsBasedCrash()
{
if (UnRecoverableError != null)
{
UnRecoverableError();
}
}
public LLUUID ConvertLocalIDToFullID(uint localID)
{
SceneObjectGroup group = GetGroupByPrim(localID);

View File

@@ -232,6 +232,15 @@ namespace OpenSim.Region.Environment.Scenes
m_permissionManager.Initialise(this);
m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
// If the Inner scene has an Unrecoverable error, restart this sim.
// Currently the only thing that causes it to happen is two kinds of specific
// Physics based crashes.
//
// Out of memory
// Operating system has killed the plugin
m_innerScene.UnRecoverableError += restartNOW;
m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
RegisterDefaultSceneEvents();
@@ -315,13 +324,17 @@ namespace OpenSim.Region.Environment.Scenes
{
t_restartTimer.Stop();
t_restartTimer.AutoReset = false;
MainLog.Instance.Error("REGION", "Closing");
Close();
MainLog.Instance.Error("REGION", "Firing Region Restart Message");
base.Restart(0);
restartNOW();
}
}
public void restartNOW()
{
MainLog.Instance.Error("REGION", "Closing");
Close();
MainLog.Instance.Error("REGION", "Firing Region Restart Message");
base.Restart(0);
}
public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e)
{
m_restartWaitTimer.Stop();

View File

@@ -171,6 +171,18 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void RequestNeighbors(RegionInfo region)
{
List<SimpleRegionInfo> neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
//IPEndPoint blah = new IPEndPoint();
//blah.Address = region.RemotingAddress;
//blah.Port = region.RemotingPort;
}
/// <summary>
///
/// </summary>
@@ -311,7 +323,7 @@ namespace OpenSim.Region.Environment.Scenes
public void InformNeighborsThatRegionisUp(RegionInfo region)
{
//MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
bool val = m_commsProvider.InterRegion.RegionUp(region);
bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
}
public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)

View File

@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
public void RestartCurrentScene()
{
ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); });
ForEachCurrentScene(delegate(Scene scene) { scene.restartNOW(); });
}