aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-28 06:18:07 +0000
committerTeravus Ovares2007-11-28 06:18:07 +0000
commitb7d596a6af51bea7dba642cdc768ac5ff77af5f3 (patch)
tree967b749b10b548f6ed687d8ade4680e411793da4 /OpenSim/Region
parentbuild ThrottleCheck function to clear up bits of the throttle (diff)
downloadopensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.zip
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.gz
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.bz2
opensim-SC-b7d596a6af51bea7dba642cdc768ac5ff77af5f3.tar.xz
* 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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalBackEndServices.cs11
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1GridServices.cs38
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs14
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs2
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs17
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs22
10 files changed, 147 insertions, 43 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index eab4827..5877aa6 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -601,6 +601,8 @@ namespace OpenSim
601 m_log.Error("show uptime - show simulator startup and uptime."); 601 m_log.Error("show uptime - show simulator startup and uptime.");
602 m_log.Error("show users - show info about connected users."); 602 m_log.Error("show users - show info about connected users.");
603 m_log.Error("show modules - shows info aboutloaded modules."); 603 m_log.Error("show modules - shows info aboutloaded modules.");
604 m_log.Error("change-region - sets the region that many of these commands affect.");
605 m_log.Error("restart - disconnects all clients and restarts the sims in the instance.");
604 m_log.Error("shutdown - disconnect all clients and shutdown."); 606 m_log.Error("shutdown - disconnect all clients and shutdown.");
605 m_log.Error("terrain help - show help for terrain commands."); 607 m_log.Error("terrain help - show help for terrain commands.");
606 m_log.Error("quit - equivalent to shutdown."); 608 m_log.Error("quit - equivalent to shutdown.");
diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
index 6e807ec..0f3ec73 100644
--- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs
@@ -106,7 +106,6 @@ namespace OpenSim.Region.Communications.Local
106 106
107 return regionHost; 107 return regionHost;
108 } 108 }
109 return null;
110 } 109 }
111 110
112 public bool DeregisterRegion(RegionInfo regionInfo) 111 public bool DeregisterRegion(RegionInfo regionInfo)
@@ -201,8 +200,9 @@ namespace OpenSim.Region.Communications.Local
201 /// <param name="agentData"></param> 200 /// <param name="agentData"></param>
202 /// <returns></returns> 201 /// <returns></returns>
203 /// 202 ///
204 public bool RegionUp(RegionInfo region) 203 public bool RegionUp(SearializableRegionInfo sregion)
205 { 204 {
205 RegionInfo region = new RegionInfo(sregion);
206 foreach (RegionCommsListener listener in m_regionListeners.Values) 206 foreach (RegionCommsListener listener in m_regionListeners.Values)
207 { 207 {
208 listener.TriggerRegionUp(region); 208 listener.TriggerRegionUp(region);
@@ -213,8 +213,13 @@ namespace OpenSim.Region.Communications.Local
213 213
214 public bool TriggerRegionUp(RegionInfo region) 214 public bool TriggerRegionUp(RegionInfo region)
215 { 215 {
216
217 foreach (RegionCommsListener listener in m_regionListeners.Values)
218 {
219 listener.TriggerRegionUp(region);
220 }
216 221
217 return false; 222 return true;
218 } 223 }
219 224
220 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData) 225 public bool InformRegionOfChildAgent(ulong regionHandle, AgentCircuitData agentData)
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index 282b720..b0442d2 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -133,14 +133,10 @@ namespace OpenSim.Region.Communications.OGS1
133 } 133 }
134 else 134 else
135 { 135 {
136 //m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY); 136 m_knownRegions = RequestNeighbours(regionInfo.RegionLocX, regionInfo.RegionLocY);
137 137
138 138
139 } 139 }
140 //SimpleRegionInfo regiondata = new SimpleRegionInfo();
141 //regiondata.RegionID = griddatahash["UUID"];
142 //regiondata.RemotingAddress =
143
144 return m_localBackend.RegisterRegion(regionInfo); 140 return m_localBackend.RegisterRegion(regionInfo);
145 } 141 }
146 142
@@ -458,7 +454,7 @@ namespace OpenSim.Region.Communications.OGS1
458 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim; 454 InterRegionSingleton.Instance.OnPrimGroupArrival += IncomingPrim;
459 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing; 455 InterRegionSingleton.Instance.OnPrimGroupNear += TriggerExpectPrimCrossing;
460 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp; 456 InterRegionSingleton.Instance.OnRegionUp += TriggerRegionUp;
461 InterRegionSingleton.Instance.OnRegionUp += RegionUp; 457 //InterRegionSingleton.Instance.OnRegionUp += RegionUp;
462 } 458 }
463 459
464 #region Methods called by regions in this instance 460 #region Methods called by regions in this instance
@@ -541,11 +537,10 @@ namespace OpenSim.Region.Communications.OGS1
541 MainLog.Instance.Debug(e.ToString()); 537 MainLog.Instance.Debug(e.ToString());
542 return false; 538 return false;
543 } 539 }
544 return true;
545 } 540 }
546 541
547 // UGLY! 542 // UGLY!
548 public bool RegionUp(RegionInfo region) 543 public bool RegionUp(SearializableRegionInfo region)
549 { 544 {
550 545
551 // This is stupid. For this to work, when the region registers it must request nearby map blocks. 546 // This is stupid. For this to work, when the region registers it must request nearby map blocks.
@@ -558,11 +553,11 @@ namespace OpenSim.Region.Communications.OGS1
558 { 553 {
559 return true; 554 return true;
560 } 555 }
561 return true; 556
562 foreach (SimpleRegionInfo knownregion in m_knownRegions) 557 foreach (SimpleRegionInfo knownregion in m_knownRegions)
563 { 558 {
564 // Wha? 559
565 RegionInfo regInfo = RequestNeighbourInfo(knownregion.RegionID); 560 SearializableRegionInfo regInfo = new SearializableRegionInfo(RequestNeighbourInfo(knownregion.RegionID));
566 561
567 try 562 try
568 { 563 {
@@ -572,7 +567,7 @@ namespace OpenSim.Region.Communications.OGS1
572 //don't want to be creating a new link to the remote instance every time like we are here 567 //don't want to be creating a new link to the remote instance every time like we are here
573 bool retValue = false; 568 bool retValue = false;
574 569
575 570
576 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject( 571 OGS1InterRegionRemoting remObject = (OGS1InterRegionRemoting)Activator.GetObject(
577 typeof(OGS1InterRegionRemoting), 572 typeof(OGS1InterRegionRemoting),
578 "tcp://" + regInfo.RemotingAddress + 573 "tcp://" + regInfo.RemotingAddress +
@@ -588,38 +583,38 @@ namespace OpenSim.Region.Communications.OGS1
588 Console.WriteLine("remoting object not found"); 583 Console.WriteLine("remoting object not found");
589 } 584 }
590 remObject = null; 585 remObject = null;
591 //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + region.RegionName + " and got " + retValue.ToString()); 586 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": OGS1 tried to NotifyRegionUp for " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
592 587
593 } 588 }
594 589
595 } 590 }
596 catch (RemotingException e) 591 catch (RemotingException e)
597 { 592 {
598 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 593 MainLog.Instance.Warn("Remoting Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
599 MainLog.Instance.Debug(e.ToString()); 594 MainLog.Instance.Debug(e.ToString());
600 //return false; 595 //return false;
601 } 596 }
602 catch (SocketException e) 597 catch (SocketException e)
603 { 598 {
604 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 599 MainLog.Instance.Warn("Socket Error: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
605 MainLog.Instance.Debug(e.ToString()); 600 MainLog.Instance.Debug(e.ToString());
606 //return false; 601 //return false;
607 } 602 }
608 catch (InvalidCredentialException e) 603 catch (InvalidCredentialException e)
609 { 604 {
610 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 605 MainLog.Instance.Warn("Invalid Credentials: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
611 MainLog.Instance.Debug(e.ToString()); 606 MainLog.Instance.Debug(e.ToString());
612 //return false; 607 //return false;
613 } 608 }
614 catch (AuthenticationException e) 609 catch (AuthenticationException e)
615 { 610 {
616 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 611 MainLog.Instance.Warn("Authentication exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
617 MainLog.Instance.Debug(e.ToString()); 612 MainLog.Instance.Debug(e.ToString());
618 //return false; 613 //return false;
619 } 614 }
620 catch (Exception e) 615 catch (Exception e)
621 { 616 {
622 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionName + " " + regInfo.RegionLocX + "," + regInfo.RegionLocY); 617 MainLog.Instance.Warn("Unknown exception: Unable to connect to adjacent region: " + regInfo.RegionLocX + "," + regInfo.RegionLocY);
623 MainLog.Instance.Debug(e.ToString()); 618 MainLog.Instance.Debug(e.ToString());
624 //return false; 619 //return false;
625 } 620 }
@@ -702,7 +697,6 @@ namespace OpenSim.Region.Communications.OGS1
702 MainLog.Instance.Debug(e.ToString()); 697 MainLog.Instance.Debug(e.ToString());
703 return false; 698 return false;
704 } 699 }
705 return true;
706 } 700 }
707 /// <summary> 701 /// <summary>
708 /// 702 ///
@@ -843,13 +837,13 @@ namespace OpenSim.Region.Communications.OGS1
843 } 837 }
844 } 838 }
845 839
846 public bool TriggerRegionUp(RegionInfo regionData) 840 public bool TriggerRegionUp(SearializableRegionInfo regionData)
847 { 841 {
848 //MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport " + regionData.RegionName); 842 MainLog.Instance.Verbose("INTER", gdebugRegionName + ": Incoming OGS1 RegionUpReport: " + regionData.RegionLocX + "," + regionData.RegionLocY);
849 843
850 try 844 try
851 { 845 {
852 return m_localBackend.TriggerRegionUp(regionData); 846 return m_localBackend.TriggerRegionUp(new RegionInfo(regionData));
853 } 847 }
854 848
855 catch (RemotingException e) 849 catch (RemotingException e)
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
index aa6f59a..2f7e591 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InterSimComms.cs
@@ -41,7 +41,7 @@ namespace OpenSim.Region.Communications.OGS1
41 41
42 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData); 42 public delegate bool PrimGroupArrival(ulong regionHandle, LLUUID primID, string objData);
43 43
44 public delegate bool RegionUP (RegionInfo region); 44 public delegate bool RegionUp (SearializableRegionInfo region);
45 45
46 public sealed class InterRegionSingleton 46 public sealed class InterRegionSingleton
47 { 47 {
@@ -76,11 +76,12 @@ namespace OpenSim.Region.Communications.OGS1
76 return false; 76 return false;
77 } 77 }
78 78
79 public bool RegionUp(RegionInfo region) 79 public bool RegionUp(SearializableRegionInfo sregion)
80 { 80 {
81
81 if (OnRegionUp != null) 82 if (OnRegionUp != null)
82 { 83 {
83 return OnRegionUp(region); 84 return OnRegionUp(sregion);
84 } 85 }
85 return false; 86 return false;
86 } 87 }
@@ -129,7 +130,7 @@ namespace OpenSim.Region.Communications.OGS1
129 return false; 130 return false;
130 } 131 }
131 } 132 }
132 public bool RegionUp(RegionInfo region) 133 public bool RegionUp(SearializableRegionInfo region)
133 { 134 {
134 try 135 try
135 { 136 {
@@ -141,6 +142,7 @@ namespace OpenSim.Region.Communications.OGS1
141 return false; 142 return false;
142 } 143 }
143 } 144 }
145
144 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying) 146 public bool ExpectAvatarCrossing(ulong regionHandle, LLUUID agentID, LLVector3 position, bool isFlying)
145 { 147 {
146 try 148 try
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 8f7cbee..c1acde4 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -11,8 +11,14 @@ using OpenSim.Region.Physics.Manager;
11 11
12namespace OpenSim.Region.Environment.Scenes 12namespace OpenSim.Region.Environment.Scenes
13{ 13{
14 public delegate void PhysicsCrash();
15
14 public class InnerScene 16 public class InnerScene
15 { 17 {
18 #region Events
19 public event PhysicsCrash UnRecoverableError;
20 #endregion
21
16 #region Fields 22 #region Fields
17 public Dictionary<LLUUID, ScenePresence> ScenePresences; 23 public Dictionary<LLUUID, ScenePresence> ScenePresences;
18 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects; 24 public Dictionary<LLUUID, SceneObjectGroup> SceneObjects;
@@ -26,17 +32,47 @@ namespace OpenSim.Region.Environment.Scenes
26 32
27 internal object m_syncRoot = new object(); 33 internal object m_syncRoot = new object();
28 34
29 public PhysicsScene PhyScene; 35 public PhysicsScene _PhyScene;
30 #endregion 36 #endregion
31 37
32 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr) 38 public InnerScene(Scene parent, RegionInfo regInfo, PermissionManager permissionsMngr)
33 { 39 {
40
34 m_parentScene = parent; 41 m_parentScene = parent;
35 m_regInfo = regInfo; 42 m_regInfo = regInfo;
36 PermissionsMngr = permissionsMngr; 43 PermissionsMngr = permissionsMngr;
37 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); 44 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256);
38 QuadTree.Subdivide(); 45 QuadTree.Subdivide();
39 QuadTree.Subdivide(); 46 QuadTree.Subdivide();
47
48
49 }
50 public PhysicsScene PhyScene
51 {
52 get
53 { return _PhyScene; }
54 set
55 {
56 // If we're not doing the initial set
57 // Then we've got to remove the previous
58 // event handler
59 try
60 {
61 _PhyScene.OnPhysicsCrash -= physicsBasedCrash;
62 }
63 catch (System.NullReferenceException)
64 {
65 // This occurs when storing to _PhyScene the first time.
66 // Is there a better way to check the event handler before
67 // getting here
68 // This can be safely ignored. We're setting the first inital
69 // there are no event handler's registered.
70 }
71
72 _PhyScene = value;
73
74 _PhyScene.OnPhysicsCrash += physicsBasedCrash;
75 }
40 } 76 }
41 77
42 public void Close() 78 public void Close()
@@ -55,9 +91,9 @@ namespace OpenSim.Region.Environment.Scenes
55 91
56 // PhysX does this (runs in the background). 92 // PhysX does this (runs in the background).
57 93
58 if (PhyScene.IsThreaded) 94 if (_PhyScene.IsThreaded)
59 { 95 {
60 PhyScene.GetResults(); 96 _PhyScene.GetResults();
61 } 97 }
62 } 98 }
63 99
@@ -75,7 +111,7 @@ namespace OpenSim.Region.Environment.Scenes
75 { 111 {
76 lock (m_syncRoot) 112 lock (m_syncRoot)
77 { 113 {
78 PhyScene.Simulate((float)elapsed); 114 _PhyScene.Simulate((float)elapsed);
79 } 115 }
80 } 116 }
81 117
@@ -338,6 +374,15 @@ namespace OpenSim.Region.Environment.Scenes
338 374
339 #region Other Methods 375 #region Other Methods
340 376
377
378 public void physicsBasedCrash()
379 {
380 if (UnRecoverableError != null)
381 {
382 UnRecoverableError();
383 }
384 }
385
341 public LLUUID ConvertLocalIDToFullID(uint localID) 386 public LLUUID ConvertLocalIDToFullID(uint localID)
342 { 387 {
343 SceneObjectGroup group = GetGroupByPrim(localID); 388 SceneObjectGroup group = GetGroupByPrim(localID);
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bdafce8..1359bd2 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -232,6 +232,15 @@ namespace OpenSim.Region.Environment.Scenes
232 m_permissionManager.Initialise(this); 232 m_permissionManager.Initialise(this);
233 233
234 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager); 234 m_innerScene = new InnerScene(this, m_regInfo, m_permissionManager);
235
236 // If the Inner scene has an Unrecoverable error, restart this sim.
237 // Currently the only thing that causes it to happen is two kinds of specific
238 // Physics based crashes.
239 //
240 // Out of memory
241 // Operating system has killed the plugin
242 m_innerScene.UnRecoverableError += restartNOW;
243
235 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo); 244 m_sceneXmlLoader = new SceneXmlLoader(this, m_innerScene, m_regInfo);
236 245
237 RegisterDefaultSceneEvents(); 246 RegisterDefaultSceneEvents();
@@ -315,13 +324,17 @@ namespace OpenSim.Region.Environment.Scenes
315 { 324 {
316 t_restartTimer.Stop(); 325 t_restartTimer.Stop();
317 t_restartTimer.AutoReset = false; 326 t_restartTimer.AutoReset = false;
318 MainLog.Instance.Error("REGION", "Closing"); 327 restartNOW();
319 Close();
320 MainLog.Instance.Error("REGION", "Firing Region Restart Message");
321 base.Restart(0);
322 } 328 }
323 329
324 } 330 }
331 public void restartNOW()
332 {
333 MainLog.Instance.Error("REGION", "Closing");
334 Close();
335 MainLog.Instance.Error("REGION", "Firing Region Restart Message");
336 base.Restart(0);
337 }
325 public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e) 338 public void restart_Notify_Wait_Elapsed(object sender, ElapsedEventArgs e)
326 { 339 {
327 m_restartWaitTimer.Stop(); 340 m_restartWaitTimer.Stop();
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 9a83710..892bf81 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -171,6 +171,18 @@ namespace OpenSim.Region.Environment.Scenes
171 } 171 }
172 } 172 }
173 173
174 public void RequestNeighbors(RegionInfo region)
175 {
176 List<SimpleRegionInfo> neighbours =
177 m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
178 //IPEndPoint blah = new IPEndPoint();
179
180 //blah.Address = region.RemotingAddress;
181 //blah.Port = region.RemotingPort;
182
183
184 }
185
174 /// <summary> 186 /// <summary>
175 /// 187 ///
176 /// </summary> 188 /// </summary>
@@ -311,7 +323,7 @@ namespace OpenSim.Region.Environment.Scenes
311 public void InformNeighborsThatRegionisUp(RegionInfo region) 323 public void InformNeighborsThatRegionisUp(RegionInfo region)
312 { 324 {
313 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName); 325 //MainLog.Instance.Verbose("INTER", debugRegionName + ": SceneCommunicationService: Sending InterRegion Notification that region is up " + region.RegionName);
314 bool val = m_commsProvider.InterRegion.RegionUp(region); 326 bool val = m_commsProvider.InterRegion.RegionUp(new SearializableRegionInfo(region));
315 } 327 }
316 328
317 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical) 329 public bool PrimCrossToNeighboringRegion(ulong regionhandle, LLUUID primID, LLVector3 position, bool isPhysical)
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index eba45fc..ed33bf7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -216,7 +216,7 @@ namespace OpenSim.Region.Environment.Scenes
216 216
217 public void RestartCurrentScene() 217 public void RestartCurrentScene()
218 { 218 {
219 ForEachCurrentScene(delegate(Scene scene) { scene.Restart(15); }); 219 ForEachCurrentScene(delegate(Scene scene) { scene.restartNOW(); });
220 220
221 } 221 }
222 222
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 651992c..635b208 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -32,12 +32,29 @@ using OpenSim.Region.Physics.Manager;
32 32
33namespace OpenSim.Region.Physics.Manager 33namespace OpenSim.Region.Physics.Manager
34{ 34{
35 public delegate void physicsCrash();
36
35 public abstract class PhysicsScene 37 public abstract class PhysicsScene
36 { 38 {
39 // The only thing that should register for this event is the InnerScene
40 // Anything else could cause problems.
41
42 public event physicsCrash OnPhysicsCrash;
43
37 public static PhysicsScene Null 44 public static PhysicsScene Null
38 { 45 {
39 get { return new NullPhysicsScene(); } 46 get { return new NullPhysicsScene(); }
40 } 47 }
48 public virtual void TriggerPhysicsBasedRestart()
49 {
50 physicsCrash handler = OnPhysicsCrash;
51 if (handler != null)
52 {
53 OnPhysicsCrash();
54 }
55
56 }
57
41 58
42 public abstract void Initialise(IMesher meshmerizer); 59 public abstract void Initialise(IMesher meshmerizer);
43 60
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index ec7d04d..7193886 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -32,6 +32,7 @@ using Axiom.Math;
32using Ode.NET; 32using Ode.NET;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Region.Physics.Manager; 34using OpenSim.Region.Physics.Manager;
35
35//using OpenSim.Region.Physics.OdePlugin.Meshing; 36//using OpenSim.Region.Physics.OdePlugin.Meshing;
36 37
37namespace OpenSim.Region.Physics.OdePlugin 38namespace OpenSim.Region.Physics.OdePlugin
@@ -234,9 +235,16 @@ namespace OpenSim.Region.Physics.OdePlugin
234 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); 235 //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2);
235 } 236 }
236 237
237 int count; 238 int count = 0;
238 239 try
240 {
239 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 241 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
242 }
243 catch (System.Runtime.InteropServices.SEHException)
244 {
245 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
246 base.TriggerPhysicsBasedRestart();
247 }
240 248
241 for (int i = 0; i < count; i++) 249 for (int i = 0; i < count; i++)
242 { 250 {
@@ -805,8 +813,14 @@ namespace OpenSim.Region.Physics.OdePlugin
805 { 813 {
806 // Process 10 frames if the sim is running normal.. 814 // Process 10 frames if the sim is running normal..
807 // process 5 frames if the sim is running slow 815 // process 5 frames if the sim is running slow
808 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 816 try{
809 817 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
818 }
819 catch (System.StackOverflowException)
820 {
821 OpenSim.Framework.Console.MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
822 base.TriggerPhysicsBasedRestart();
823 }
810 824
811 int i = 0; 825 int i = 0;
812 while (step_time > 0.0f) 826 while (step_time > 0.0f)