diff options
author | Robert Adams | 2019-02-27 07:49:52 -0800 |
---|---|---|
committer | Robert Adams | 2019-02-27 07:49:52 -0800 |
commit | bd1b992aaf57154fd57403348a1ab63bfd918ad9 (patch) | |
tree | 45c627049706614e14de445e9dab2dcc9b072b9a /OpenSim/Framework/Servers | |
parent | combat module: those parcel changes are now handled elsewhere (diff) | |
download | opensim-SC-bd1b992aaf57154fd57403348a1ab63bfd918ad9.zip opensim-SC-bd1b992aaf57154fd57403348a1ab63bfd918ad9.tar.gz opensim-SC-bd1b992aaf57154fd57403348a1ab63bfd918ad9.tar.bz2 opensim-SC-bd1b992aaf57154fd57403348a1ab63bfd918ad9.tar.xz |
Add Thread.ResetAbort() to various thread loops to clean up errors on
shutdown. Fixes Mantis #8494.
Threads are aborted when shutting down and ThreadAbortException is odd
in that it is rethrown at the end of the catch unless the abort is
reset. No functional changes but fewer error messages on shutdown.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index b9ac155..14e21a2 100644..100755 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -230,25 +230,25 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
230 | PollServiceHttpRequest req; | 230 | PollServiceHttpRequest req; |
231 | while (m_running) | 231 | while (m_running) |
232 | { | 232 | { |
233 | req = null; | 233 | try |
234 | if(!m_requests.TryTake(out req, 4500) || req == null) | ||
235 | { | 234 | { |
236 | Watchdog.UpdateThread(); | 235 | req = null; |
237 | continue; | 236 | if (!m_requests.TryTake(out req, 4500) || req == null) |
238 | } | 237 | { |
238 | Watchdog.UpdateThread(); | ||
239 | continue; | ||
240 | } | ||
239 | 241 | ||
240 | Watchdog.UpdateThread(); | 242 | Watchdog.UpdateThread(); |
241 | 243 | ||
242 | try | 244 | if (!req.HttpContext.CanSend()) |
243 | { | ||
244 | if(!req.HttpContext.CanSend()) | ||
245 | { | 245 | { |
246 | req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id); | 246 | req.PollServiceArgs.Drop(req.RequestID, req.PollServiceArgs.Id); |
247 | byContextDequeue(req); | 247 | byContextDequeue(req); |
248 | continue; | 248 | continue; |
249 | } | 249 | } |
250 | 250 | ||
251 | if(req.HttpContext.IsSending()) | 251 | if (req.HttpContext.IsSending()) |
252 | { | 252 | { |
253 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) | 253 | if ((Environment.TickCount - req.RequestTime) > req.PollServiceArgs.TimeOutms) |
254 | { | 254 | { |
@@ -256,7 +256,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
256 | byContextDequeue(req); | 256 | byContextDequeue(req); |
257 | } | 257 | } |
258 | else | 258 | else |
259 | ReQueueEvent(req); | 259 | ReQueueEvent(req); |
260 | continue; | 260 | continue; |
261 | } | 261 | } |
262 | 262 | ||
@@ -290,7 +290,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
290 | { | 290 | { |
291 | nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); | 291 | nreq.DoHTTPGruntWork(nreq.PollServiceArgs.NoEvents(nreq.RequestID, nreq.PollServiceArgs.Id)); |
292 | } | 292 | } |
293 | catch (ObjectDisposedException) {} | 293 | catch (ObjectDisposedException) { } |
294 | finally | 294 | finally |
295 | { | 295 | { |
296 | byContextDequeue(nreq); | 296 | byContextDequeue(nreq); |
@@ -305,6 +305,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | } | 307 | } |
308 | catch (ThreadAbortException) | ||
309 | { | ||
310 | Thread.ResetAbort(); | ||
311 | // Shouldn't set this to 'false', the normal shutdown should cause things to exit | ||
312 | // m_running = false; | ||
313 | } | ||
308 | catch (Exception e) | 314 | catch (Exception e) |
309 | { | 315 | { |
310 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); | 316 | m_log.ErrorFormat("Exception in poll service thread: " + e.ToString()); |