From 3aa86d22d16cbf82702024bdfc9846a4c3147232 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 31 Aug 2011 17:38:32 +0100 Subject: [PATCH] If a FireAndForget thread terminates with an exception, then catch and log rather than letting it terminate the simulator. Exceptions don't appear to do this with the SmartThreadPool but they do with UnsafeQueueUserWorkItem (and maybe others) --- OpenSim/Framework/Util.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 51ced7b3ac..745da17665 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1508,7 +1508,21 @@ namespace OpenSim.Framework // When OpenSim interacts with a database or sends data over the wire, it must send this in en_US culture // so that we don't encounter problems where, for instance, data is saved with a culture that uses commas // for decimals places but is read by a culture that treats commas as number seperators. - WaitCallback realCallback = delegate(object o) { Culture.SetCurrentCulture(); callback(o); }; + WaitCallback realCallback = delegate(object o) + { + Culture.SetCurrentCulture(); + + try + { + callback(o); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[UTIL]: Continuing after async_call_method thread terminated with exception {0}{1}", + e.Message, e.StackTrace); + } + }; switch (FireAndForgetMethod) {