diff options
author | Oren Hurvitz | 2015-07-05 16:05:01 +0300 |
---|---|---|
committer | Oren Hurvitz | 2015-08-11 07:35:37 +0100 |
commit | 4ad1468165b80f67439399e36688d36944996312 (patch) | |
tree | 541cfb87ecae92a3bff53aaa8875b06d83878a35 /OpenSim/Framework/Util.cs | |
parent | Fixed mistakes in string format specifiers (e.g., "{0)" instead of {0}") (diff) | |
download | opensim-SC-4ad1468165b80f67439399e36688d36944996312.zip opensim-SC-4ad1468165b80f67439399e36688d36944996312.tar.gz opensim-SC-4ad1468165b80f67439399e36688d36944996312.tar.bz2 opensim-SC-4ad1468165b80f67439399e36688d36944996312.tar.xz |
Better handling of invalid XML: a) prevent infinite loop on EOF; b) better logging
If the XML was truncated for some reason then ExecuteReadProcessors() would get into an infinite loop, using high CPU. Now it detects EOF (and several other error cases) and aborts.
The rest of the changes just improve logging of XML in case of errors, so that we can see what the bad XML is.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 875f4ad..a5f798d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2910,6 +2910,16 @@ namespace OpenSim.Framework | |||
2910 | 2910 | ||
2911 | return name; | 2911 | return name; |
2912 | } | 2912 | } |
2913 | |||
2914 | public static void LogFailedXML(string message, string xml) | ||
2915 | { | ||
2916 | int length = xml.Length; | ||
2917 | if (length > 2000) | ||
2918 | xml = xml.Substring(0, 2000) + "..."; | ||
2919 | |||
2920 | m_log.ErrorFormat("{0} Failed XML ({1} bytes) = {2}", message, length, xml); | ||
2921 | } | ||
2922 | |||
2913 | } | 2923 | } |
2914 | 2924 | ||
2915 | public class DoubleQueue<T> where T:class | 2925 | public class DoubleQueue<T> where T:class |