diff options
author | Justin Clarke Casey | 2009-06-05 16:14:22 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-06-05 16:14:22 +0000 |
commit | 593942b195cb5b29b47bd077cf53c32699fd2ff8 (patch) | |
tree | c2fc437583fd03468446f3680de41336bf62e8b3 /OpenSim/Framework | |
parent | * Add oar saving timeout (diff) | |
download | opensim-SC-593942b195cb5b29b47bd077cf53c32699fd2ff8.zip opensim-SC-593942b195cb5b29b47bd077cf53c32699fd2ff8.tar.gz opensim-SC-593942b195cb5b29b47bd077cf53c32699fd2ff8.tar.bz2 opensim-SC-593942b195cb5b29b47bd077cf53c32699fd2ff8.tar.xz |
* Fix problem where known missing assets would stop save oar ever completing
* Issue was that region server was silently dropping an XmlException caused by trying to deserialize the blank asset service response
* So make asset service return http status NOT FOUND rather than OK in accordance with REST
* and interpret this correctly in the async response so that a null object is sent back
* This means that this fix won't be active until both region simulator and server reach this revision
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs | 8 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | 60 |
2 files changed, 55 insertions, 13 deletions
diff --git a/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs b/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs index 83a5676..8372ae7 100644 --- a/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseGetAssetStreamHandler.cs | |||
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Servers | |||
64 | 64 | ||
65 | if (!UUID.TryParse(p[0], out assetID)) | 65 | if (!UUID.TryParse(p[0], out assetID)) |
66 | { | 66 | { |
67 | m_log.InfoFormat( | 67 | m_log.DebugFormat( |
68 | "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); | 68 | "[REST]: GET:/asset ignoring request with malformed UUID {0}", p[0]); |
69 | return result; | 69 | return result; |
70 | } | 70 | } |
@@ -91,12 +91,14 @@ namespace OpenSim.Framework.Servers | |||
91 | } | 91 | } |
92 | else | 92 | else |
93 | { | 93 | { |
94 | m_log.DebugFormat("[REST]: GET:/asset failed to find {0}", assetID); | ||
95 | |||
96 | httpResponse.StatusCode = (int)HttpStatusCode.NotFound; | ||
97 | |||
94 | if (StatsManager.AssetStats != null) | 98 | if (StatsManager.AssetStats != null) |
95 | { | 99 | { |
96 | StatsManager.AssetStats.AddNotFoundRequest(); | 100 | StatsManager.AssetStats.AddNotFoundRequest(); |
97 | } | 101 | } |
98 | |||
99 | m_log.InfoFormat("[REST]: GET:/asset failed to find {0}", assetID); | ||
100 | } | 102 | } |
101 | } | 103 | } |
102 | 104 | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs index 76d0b6f..fe69ad3 100644 --- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | |||
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
38 | { | 38 | { |
39 | public class AsynchronousRestObjectRequester | 39 | public class AsynchronousRestObjectRequester |
40 | { | 40 | { |
41 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 41 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
42 | 42 | ||
43 | /// <summary> | 43 | /// <summary> |
44 | /// Perform an asynchronous REST request. | 44 | /// Perform an asynchronous REST request. |
@@ -56,7 +56,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
56 | public static void MakeRequest<TRequest, TResponse>(string verb, | 56 | public static void MakeRequest<TRequest, TResponse>(string verb, |
57 | string requestUrl, TRequest obj, Action<TResponse> action) | 57 | string requestUrl, TRequest obj, Action<TResponse> action) |
58 | { | 58 | { |
59 | //m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} on {1}", verb, requestUrl); | 59 | // m_log.DebugFormat("[ASYNC REQUEST]: Starting {0} {1}", verb, requestUrl); |
60 | 60 | ||
61 | Type type = typeof (TRequest); | 61 | Type type = typeof (TRequest); |
62 | 62 | ||
@@ -114,21 +114,61 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
114 | 114 | ||
115 | request.BeginGetResponse(delegate(IAsyncResult res2) | 115 | request.BeginGetResponse(delegate(IAsyncResult res2) |
116 | { | 116 | { |
117 | response = request.EndGetResponse(res2); | ||
118 | |||
119 | try | 117 | try |
120 | { | 118 | { |
121 | deserial = (TResponse) deserializer.Deserialize( | 119 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't |
122 | response.GetResponseStream()); | 120 | // documented in MSDN |
121 | response = request.EndGetResponse(res2); | ||
122 | |||
123 | try | ||
124 | { | ||
125 | deserial = (TResponse)deserializer.Deserialize(response.GetResponseStream()); | ||
126 | } | ||
127 | catch (System.InvalidOperationException) | ||
128 | { | ||
129 | } | ||
130 | } | ||
131 | catch (WebException e) | ||
132 | { | ||
133 | if (e.Status == WebExceptionStatus.ProtocolError) | ||
134 | { | ||
135 | if (e.Response is HttpWebResponse) | ||
136 | { | ||
137 | HttpWebResponse httpResponse = (HttpWebResponse)e.Response; | ||
138 | |||
139 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | ||
140 | { | ||
141 | // We don't appear to be handling any other status codes, so log these feailures to that | ||
142 | // people don't spend unnecessary hours hunting phantom bugs. | ||
143 | m_log.DebugFormat( | ||
144 | "[ASYNC REQUEST]: Request {0} {1} failed with unexpected status code {2}", | ||
145 | verb, requestUrl, httpResponse.StatusCode); | ||
146 | } | ||
147 | } | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e); | ||
152 | } | ||
123 | } | 153 | } |
124 | catch (System.InvalidOperationException) | 154 | catch (Exception e) |
125 | { | 155 | { |
156 | m_log.ErrorFormat("[ASYNC REQUEST]: Request {0} {1} failed with exception {2}", verb, requestUrl, e); | ||
126 | } | 157 | } |
127 | 158 | ||
128 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 159 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
129 | 160 | ||
130 | action(deserial); | 161 | try |
131 | }, null); | 162 | { |
163 | action(deserial); | ||
164 | } | ||
165 | catch (Exception e) | ||
166 | { | ||
167 | m_log.ErrorFormat( | ||
168 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); | ||
169 | } | ||
170 | |||
171 | }, null); | ||
132 | } | 172 | } |
133 | } | 173 | } |
134 | } | 174 | } |