From c62328950a3e4ad30dbe972db11d05ca7519d6de Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Mon, 18 Feb 2008 14:21:51 +0000 Subject: [PATCH] More exception checks and crash hints If no scriptengine is specified then don't try to load any. --- .../RemoteController/RemoteAdminPlugin.cs | 2 +- .../Framework/Data.MySQL/MySQLDataStore.cs | 4 +-- OpenSim/Framework/Servers/BaseHttpServer.cs | 1 + .../Statistics/SimExtraStatsReporter.cs | 8 +++-- OpenSim/Region/Application/OpenSimMain.cs | 32 ++++++++++++------- .../Physics/Manager/PhysicsPluginManager.cs | 8 +++++ 6 files changed, 38 insertions(+), 17 deletions(-) diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index a6d508939a..005bfd7b31 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs @@ -56,7 +56,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { try { - if (openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) + if (openSim.ConfigSource.Configs["RemoteAdmin"] != null && openSim.ConfigSource.Configs["RemoteAdmin"].GetBoolean("enabled", false)) { m_log.Info("[RADMIN]: Remote Admin Plugin Enabled"); requiredPassword = openSim.ConfigSource.Configs["RemoteAdmin"].GetString("access_password", String.Empty); diff --git a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs index 9518724f25..1edaa5276d 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLDataStore.cs @@ -421,8 +421,8 @@ namespace OpenSim.Framework.Data.MySQL public void StoreLandObject(Land parcel, LLUUID regionUUID) { // Does the new locking fix it? - m_log.Info("[DATASTORE]: Tedds temp fix: Waiting 3 seconds for stuff to catch up. (Someone please fix! :))"); - System.Threading.Thread.Sleep(2500 + rnd.Next(300, 900)); + m_log.Info("[DATASTORE]: Tedds temp fix: Waiting 3 seconds to avoid others writing to table while we hold a dataset of it. (Someone please fix! :))"); + System.Threading.Thread.Sleep(2500 + rnd.Next(0, 1000)); lock (m_dataSet) { diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index cc0c0d00db..6b576e6f30 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -559,6 +559,7 @@ namespace OpenSim.Framework.Servers catch (Exception e) { m_log.Warn("[HTTPD]: Error - " + e.Message); + m_log.Warn("Tip: Do you have permission to listen on port " + m_port + "?"); } } diff --git a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs b/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs index 73f36f94a2..c8b8223ac5 100644 --- a/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs +++ b/OpenSim/Framework/Statistics/SimExtraStatsReporter.cs @@ -50,8 +50,12 @@ namespace OpenSim.Framework.Statistics public void AddTexture(AssetBase image) { - texturesInCache++; - textureCacheMemoryUsage += image.Data.Length; + // Tedd: I added null check to avoid exception. Don't know if texturesInCache should ++ anyway? + if (image.Data != null) + { + texturesInCache++; + textureCacheMemoryUsage += image.Data.Length; + } } /// diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 1e5fcfbc96..8c6ea26b99 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs @@ -181,7 +181,7 @@ namespace OpenSim config.Set("storage_prim_inventories", true); config.Set("startup_console_commands_file", String.Empty); config.Set("shutdown_console_commands_file", String.Empty); - config.Set("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); + config.Set("script_engine", ""); config.Set("asset_database", "sqlite"); } @@ -264,7 +264,7 @@ namespace OpenSim m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", String.Empty); m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", String.Empty); - m_scriptEngine = startupConfig.GetString("script_engine", "OpenSim.Region.ScriptEngine.DotNetEngine.dll"); + m_scriptEngine = startupConfig.GetString("script_engine", ""); m_assetStorage = startupConfig.GetString("asset_database", "sqlite"); @@ -449,18 +449,26 @@ namespace OpenSim m_moduleLoader.PickupModules(scene, "."); //m_moduleLoader.PickupModules(scene, "ScriptEngines"); //m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", m_scriptEngine), scene); - m_log.Info("[MODULES]: Loading scripting engine modules"); - foreach (string module in m_scriptEngine.Split(',')) + + if (string.IsNullOrEmpty(m_scriptEngine)) { - string mod = module.Trim(" \t".ToCharArray()); // Clean up name - m_log.Info("[MODULES]: Loading scripting engine: " + mod); - try + m_log.Info("[MODULES]: No script engien module specified"); + } + else + { + m_log.Info("[MODULES]: Loading scripting engine modules"); + foreach (string module in m_scriptEngine.Split(',')) { - m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); - } - catch (Exception ex) - { - m_log.Error("[MODULES]: Failed to load script engine: " + ex.ToString()); + string mod = module.Trim(" \t".ToCharArray()); // Clean up name + m_log.Info("[MODULES]: Loading scripting engine: " + mod); + try + { + m_moduleLoader.LoadRegionModules(Path.Combine("ScriptEngines", mod), scene); + } + catch (Exception ex) + { + m_log.Error("[MODULES]: Failed to load script engine: " + ex.ToString()); + } } } diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 76ea503b62..ac05576565 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -106,6 +106,14 @@ namespace OpenSim.Region.Physics.Manager private void AddPlugin(string FileName) { + // TODO / NOTE + // The assembly named 'OpenSim.Region.Physics.BasicPhysicsPlugin' was loaded from + // 'file:///C:/OpenSim/trunk2/bin/Physics/OpenSim.Region.Physics.BasicPhysicsPlugin.dll' + // using the LoadFrom context. The use of this context can result in unexpected behavior + // for serialization, casting and dependency resolution. In almost all cases, it is recommended + // that the LoadFrom context be avoided. This can be done by installing assemblies in the + // Global Assembly Cache or in the ApplicationBase directory and using Assembly. + // Load when explicitly loading assemblies. Assembly pluginAssembly = Assembly.LoadFrom(FileName); foreach (Type pluginType in pluginAssembly.GetTypes())