aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-06-01 16:00:46 +0000
committerJustin Clarke Casey2009-06-01 16:00:46 +0000
commitecbeb5cea15e558b1df361dc90f1bf24bbc87152 (patch)
tree50dea4d3ea9b5ab3f71db0c03860de830c1674aa /OpenSim
parentFixed AvatarCreationModule (I think) (diff)
downloadopensim-SC_OLD-ecbeb5cea15e558b1df361dc90f1bf24bbc87152.zip
opensim-SC_OLD-ecbeb5cea15e558b1df361dc90f1bf24bbc87152.tar.gz
opensim-SC_OLD-ecbeb5cea15e558b1df361dc90f1bf24bbc87152.tar.bz2
opensim-SC_OLD-ecbeb5cea15e558b1df361dc90f1bf24bbc87152.tar.xz
* Fix race condition in save oar
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs70
5 files changed, 52 insertions, 32 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index c6c8b70..47240a1 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -311,8 +311,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
311 } 311 }
312 catch (Exception e) 312 catch (Exception e)
313 { 313 {
314 m_log.ErrorFormat("[RADMIN] Terrain Loading: failed: {0}", e.Message); 314 m_log.ErrorFormat("[RADMIN]: Terrain Loading: failed: {0}", e.Message);
315 m_log.DebugFormat("[RADMIN] Terrain Loading: failed: {0}", e.ToString()); 315 m_log.DebugFormat("[RADMIN]: Terrain Loading: failed: {0}", e.ToString());
316 316
317 responseData["success"] = false; 317 responseData["success"] = false;
318 responseData["error"] = e.Message; 318 responseData["error"] = e.Message;
@@ -325,7 +325,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
325 325
326 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) 326 public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient)
327 { 327 {
328
329 m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); 328 m_log.Info("[RADMIN]: Received Shutdown Administrator Request");
330 329
331 XmlRpcResponse response = new XmlRpcResponse(); 330 XmlRpcResponse response = new XmlRpcResponse();
@@ -759,7 +758,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
759 /// <description>error message if success is false</description></item> 758 /// <description>error message if success is false</description></item>
760 /// </list> 759 /// </list>
761 /// </remarks> 760 /// </remarks>
762
763 public XmlRpcResponse XmlRpcModifyRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient) 761 public XmlRpcResponse XmlRpcModifyRegionMethod(XmlRpcRequest request, IPEndPoint remoteClient)
764 { 762 {
765 m_log.Info("[RADMIN]: ModifyRegion: new request"); 763 m_log.Info("[RADMIN]: ModifyRegion: new request");
diff --git a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
index 96366f1..995a47a 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectors/Asset/LocalAssetServiceConnector.cs
@@ -196,6 +196,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
196 public bool Get(string id, Object sender, AssetRetrieved handler) 196 public bool Get(string id, Object sender, AssetRetrieved handler)
197 { 197 {
198 AssetBase asset = null; 198 AssetBase asset = null;
199
199 if (m_Cache != null) 200 if (m_Cache != null)
200 m_Cache.Get(id); 201 m_Cache.Get(id);
201 202
@@ -209,6 +210,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
209 { 210 {
210 if ((a != null) && (m_Cache != null)) 211 if ((a != null) && (m_Cache != null))
211 m_Cache.Cache(a); 212 m_Cache.Cache(a);
213
212 handler.BeginInvoke(assetID, s, a, null, null); 214 handler.BeginInvoke(assetID, s, a, null, null);
213 }); 215 });
214 } 216 }
@@ -217,8 +219,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectors.Asset
217 { 219 {
218 if (m_Cache != null) 220 if (m_Cache != null)
219 m_Cache.Cache(asset); 221 m_Cache.Cache(asset);
222
220 if (asset.Temporary || asset.Local) 223 if (asset.Temporary || asset.Local)
221 return asset.ID; 224 return asset.ID;
225
222 return m_AssetService.Store(asset); 226 return m_AssetService.Store(asset);
223 } 227 }
224 228
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 7fe6d2e..74904e2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -310,6 +310,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
310 asset.Type = assetType; 310 asset.Type = assetType;
311 asset.Data = data; 311 asset.Data = data;
312 312
313 // We're relying on the asset service to do the sensible thing and not store the asset if it already
314 // exists.
313 m_scene.AssetService.Store(asset); 315 m_scene.AssetService.Store(asset);
314 316
315 /** 317 /**
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
index 4819746..9fd9469 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestExecution.cs
@@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
136 136
137 m_archiveWriter.Close(); 137 m_archiveWriter.Close();
138 138
139 m_log.InfoFormat("[ARCHIVER]: Wrote out OpenSimulator archive for {0}", m_scene.RegionInfo.RegionName); 139 m_log.InfoFormat("[ARCHIVER]: Finished writing out OAR for {0}", m_scene.RegionInfo.RegionName);
140 140
141 m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty); 141 m_scene.EventManager.TriggerOarFileSaved(m_requestId, String.Empty);
142 } 142 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index c673e18..129d6d3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -70,20 +70,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
70 private int m_repliesRequired; 70 private int m_repliesRequired;
71 71
72 /// <value> 72 /// <value>
73 /// Asset cache used to request the assets 73 /// Asset service used to request the assets
74 /// </value> 74 /// </value>
75 protected IAssetService m_assetCache; 75 protected IAssetService m_assetService;
76 76
77 protected AssetsArchiver m_assetsArchiver; 77 protected AssetsArchiver m_assetsArchiver;
78 78
79 protected internal AssetsRequest( 79 protected internal AssetsRequest(
80 AssetsArchiver assetsArchiver, ICollection<UUID> uuids, 80 AssetsArchiver assetsArchiver, ICollection<UUID> uuids,
81 IAssetService assetCache, AssetsRequestCallback assetsRequestCallback) 81 IAssetService assetService, AssetsRequestCallback assetsRequestCallback)
82 { 82 {
83 m_assetsArchiver = assetsArchiver; 83 m_assetsArchiver = assetsArchiver;
84 m_uuids = uuids; 84 m_uuids = uuids;
85 m_assetsRequestCallback = assetsRequestCallback; 85 m_assetsRequestCallback = assetsRequestCallback;
86 m_assetCache = assetCache; 86 m_assetService = assetService;
87 m_repliesRequired = uuids.Count; 87 m_repliesRequired = uuids.Count;
88 } 88 }
89 89
@@ -93,14 +93,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver
93 93
94 // We can stop here if there are no assets to fetch 94 // We can stop here if there are no assets to fetch
95 if (m_repliesRequired == 0) 95 if (m_repliesRequired == 0)
96 m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids); 96 PerformAssetsRequestCallback();
97 97
98 foreach (UUID uuid in m_uuids) 98 foreach (UUID uuid in m_uuids)
99 { 99 {
100 m_assetCache.Get(uuid.ToString(), this, AssetRequestCallback); 100 m_assetService.Get(uuid.ToString(), this, AssetRequestCallback);
101 } 101 }
102 } 102 }
103 103
104 private bool done = false;
104 /// <summary> 105 /// <summary>
105 /// Called back by the asset cache when it has the asset 106 /// Called back by the asset cache when it has the asset
106 /// </summary> 107 /// </summary>
@@ -108,29 +109,44 @@ namespace OpenSim.Region.CoreModules.World.Archiver
108 /// <param name="asset"></param> 109 /// <param name="asset"></param>
109 public void AssetRequestCallback(string id, object sender, AssetBase asset) 110 public void AssetRequestCallback(string id, object sender, AssetBase asset)
110 { 111 {
111 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", assetID); 112 try
112
113 if (asset != null)
114 {
115 m_foundAssetUuids.Add(asset.FullID);
116 m_assetsArchiver.WriteAsset(asset);
117 }
118 else
119 { 113 {
120 m_notFoundAssetUuids.Add(new UUID(id)); 114 lock (this)
115 {
116 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
117
118 if (asset != null)
119 {
120 m_foundAssetUuids.Add(asset.FullID);
121 m_assetsArchiver.WriteAsset(asset);
122 }
123 else
124 {
125 m_notFoundAssetUuids.Add(new UUID(id));
126 }
127
128 if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
129 {
130 if (done)
131 throw new Exception("AArgh");
132
133 m_log.DebugFormat(
134 "[ARCHIVER]: Successfully added {0} assets ({1} assets missing)",
135 m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
136
137 done = true;
138
139 // We want to stop using the asset cache thread asap
140 // as we now need to do the work of producing the rest of the archive
141 Thread newThread = new Thread(PerformAssetsRequestCallback);
142 newThread.Name = "OpenSimulator archiving thread post assets receipt";
143 newThread.Start();
144 }
145 }
121 } 146 }
122 147 catch (Exception e)
123 if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired)
124 { 148 {
125 m_log.DebugFormat( 149 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
126 "[ARCHIVER]: Successfully added {0} assets ({1} assets missing)",
127 m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
128
129 // We want to stop using the asset cache thread asap
130 // as we now need to do the work of producing the rest of the archive
131 Thread newThread = new Thread(PerformAssetsRequestCallback);
132 newThread.Name = "OpenSimulator archiving thread post assets receipt";
133 newThread.Start();
134 } 150 }
135 } 151 }
136 152