From d3fb6039cad7b828dec8a1d7aef66aa10e6afdf2 Mon Sep 17 00:00:00 2001
From: Justin Clarke Casey
Date: Mon, 12 May 2008 16:57:56 +0000
Subject: * If a region running in grid mode fails to login to the grid
service, startup will now terminate instead of carrying on (and thus burying
the error message)
---
OpenSim/Region/Application/OpenSimMain.cs | 13 ++++++++++-
.../Region/ClientStack/RegionApplicationBase.cs | 6 +-----
.../Region/Communications/OGS1/OGS1GridServices.cs | 25 +++++++++++-----------
OpenSim/Region/Environment/Scenes/Scene.cs | 7 ++++++
.../Scenes/SceneCommunicationService.cs | 5 +++++
5 files changed, 38 insertions(+), 18 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index d910dc4..c7094c7 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -569,7 +569,18 @@ namespace OpenSim
//moved these here as the terrain texture has to be created after the modules are initialized
// and has to happen before the region is registered with the grid.
scene.CreateTerrainTexture(true);
- scene.RegisterRegionWithGrid();
+
+ try
+ {
+ scene.RegisterRegionWithGrid();
+ }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat("[STARTUP]: Registration of region with grid failed, aborting startup - {0}", e);
+
+ // Carrying on now causes a lot of confusion down the line - we need to get the user's attention
+ System.Environment.Exit(1);
+ }
// We need to do this after we've initialized the scripting engines.
scene.StartScripts();
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index 1dcab20..5e0e074 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -129,10 +129,6 @@ namespace OpenSim.Region.ClientStack
scene.LoadWorldMap();
- //moved to opensimMain as these have to happen after modules are initialised
- // scene.CreateTerrainTexture(true);
- // scene.RegisterRegionWithGrid();
-
scene.PhysicsScene = GetPhysicsScene();
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetWaterLevel(regionInfo.EstateSettings.waterHeight);
@@ -171,4 +167,4 @@ namespace OpenSim.Region.ClientStack
protected abstract Scene CreateScene(RegionInfo regionInfo, StorageManager storageManager,
AgentCircuitManager circuitManager);
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
index eada868..03fd448 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.Communications.OGS1
// see IGridServices
public RegionCommsListener RegisterRegion(RegionInfo regionInfo)
{
- m_log.DebugFormat(
+ m_log.InfoFormat(
"[OGS1 GRID SERVICES]: Attempting to register region {0} with grid at {1}",
regionInfo.RegionName, serversInfo.GridURL);
@@ -137,14 +137,16 @@ namespace OpenSim.Region.Communications.OGS1
XmlRpcRequest GridReq = new XmlRpcRequest("simulator_login", SendParams);
GridResp = GridReq.Send(serversInfo.GridURL, 30000);
}
- catch (Exception ex)
+ catch (Exception e)
{
- m_log.ErrorFormat(
- "[OGS1 GRID SERVICES]: Unable to connect to grid at {0}. Grid server not running? Exception {1}",
- serversInfo.GridURL, ex);
+ Exception e2
+ = new Exception(
+ String.Format("Unable to connect to grid at {0}. Grid service not running?", serversInfo.GridURL),
+ e);
- throw(ex);
+ throw(e2);
}
+
Hashtable GridRespData = (Hashtable)GridResp.Value;
Hashtable griddatahash = GridRespData;
@@ -152,11 +154,10 @@ namespace OpenSim.Region.Communications.OGS1
if (GridRespData.ContainsKey("error"))
{
string errorstring = (string) GridRespData["error"];
- m_log.ErrorFormat(
- "[OGS1 GRID SERVICES]: Unable to connect to grid at {0}: {1}",
- serversInfo.GridURL, errorstring);
- return null;
+ Exception e = new Exception(String.Format("Unable to connect to grid at {0}: {1}", serversInfo.GridURL, errorstring));
+
+ throw e;
}
else
{
@@ -292,7 +293,7 @@ namespace OpenSim.Region.Communications.OGS1
if (responseData.ContainsKey("error"))
{
- Console.WriteLine("error received from grid server" + responseData["error"]);
+ m_log.WarnFormat("[OGS1 GRID SERVICES]: Error received from grid server: {0}", responseData["error"]);
return null;
}
@@ -355,7 +356,7 @@ namespace OpenSim.Region.Communications.OGS1
if (responseData.ContainsKey("error"))
{
- m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server" + responseData["error"]);
+ m_log.Error("[OGS1 GRID SERVICES]: Error received from grid server: " + responseData["error"]);
return null;
}
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e8a6c45..e18c467 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -924,13 +924,20 @@ namespace OpenSim.Region.Environment.Scenes
}
}
+ ///
+ /// Register this region with a grid service
+ ///
+ /// Thrown if registration of the region itself fails.
public void RegisterRegionWithGrid()
{
RegisterCommsEvents();
+
// These two 'commands' *must be* next to each other or sim rebooting fails.
m_sceneGridService.RegisterRegion(RegionInfo);
m_sceneGridService.InformNeighborsThatRegionisUp(RegionInfo);
+
Dictionary dGridSettings = m_sceneGridService.GetGridSettings();
+
if (dGridSettings.ContainsKey("allow_forceful_banlines"))
{
if (dGridSettings["allow_forceful_banlines"] != "TRUE")
diff --git a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
index 91bbdb7..5ef4a7d 100644
--- a/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneCommunicationService.cs
@@ -84,6 +84,11 @@ namespace OpenSim.Region.Environment.Scenes
m_commsProvider.InterRegion.rdebugRegionName = _debugRegionName;
}
+ ///
+ /// Register a region with the grid
+ ///
+ ///
+ /// Thrown if region registration fails.
public void RegisterRegion(RegionInfo regionInfos)
{
m_regionInfo = regionInfos;
--
cgit v1.1