Bug 8910 - When I try deserialize big object (230Mb) mono crashed with Arg_InsufficientSpace exception
Summary: When I try deserialize big object (230Mb) mono crashed with Arg_InsufficientS...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: unspecified
Hardware: Other All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-12-12 15:45 UTC by Andrey
Modified: 2015-03-17 06:35 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andrey 2012-12-12 15:45:07 UTC
static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                Console.WriteLine("{0} <yml file path>", Path.GetFileName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName));
                return;
            }

            var xmlFilePath = args[0];

            var serizlize = new XmlSerializer(typeof(yml_catalog));

            yml_catalog ymlCatalog;
            using (var file = new StreamReader(xmlFilePath))
            {
                ymlCatalog = (yml_catalog)serizlize.Deserialize(file);
            }
        }

Unhandled Exception:
System.ArgumentException: Arg_InsufficientSpace
Parameter name: chars
  at System.Text.UTF8Encoding.InternalGetChars (System.Byte* bytes, Int32 byteCo                                                                                        unt, System.Char* chars, Int32 charCount, System.UInt32& leftOverBits, System.UI                                                                                        nt32& leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer&                                                                                         fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x00000] in <filename                                                                                         unknown>:0
  at System.Text.UTF8Encoding.InternalGetChars (System.Byte[] bytes, Int32 byteI                                                                                        ndex, Int32 byteCount, System.Char[] chars, Int32 charIndex, System.UInt32& left                                                                                        OverBits, System.UInt32& leftOverCount, System.Object provider, System.Text.Deco                                                                                        derFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x0                                                                                        0000] in <filename unknown>:0
  at System.Text.UTF8Encoding+UTF8Decoder.GetChars (System.Byte[] bytes, Int32 b                                                                                        yteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex) [0x00000] in <f                                                                                        ilename unknown>:0
  at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32 count                                                                                        ) [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x00000] in <filen                                                                                        ame unknown>:0
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <file                                                                                        name unknown>:0
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlReader.ReadElementString () [0x00000] in <filename unknown>:0                                                                                        
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadPrimitiveVal                                                                                        ue (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename                                                                                         unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadListElement                                                                                         (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, System.Obj                                                                                        ect list, Boolean canCreateInstance) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System                                                                                        .Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x0                                                                                        0000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serializatio                                                                                        n.XmlSerializationReader reader) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: Arg_InsufficientSpa                                                                                        ce
Parameter name: chars
  at System.Text.UTF8Encoding.InternalGetChars (System.Byte* bytes, Int32 byteCo                                                                                        unt, System.Char* chars, Int32 charCount, System.UInt32& leftOverBits, System.UI                                                                                        nt32& leftOverCount, System.Object provider, System.Text.DecoderFallbackBuffer&                                                                                         fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x00000] in <filename                                                                                         unknown>:0
  at System.Text.UTF8Encoding.InternalGetChars (System.Byte[] bytes, Int32 byteI                                                                                        ndex, Int32 byteCount, System.Char[] chars, Int32 charIndex, System.UInt32& left                                                                                        OverBits, System.UInt32& leftOverCount, System.Object provider, System.Text.Deco                                                                                        derFallbackBuffer& fallbackBuffer, System.Byte[]& bufferArg, Boolean flush) [0x0                                                                                        0000] in <filename unknown>:0
  at System.Text.UTF8Encoding+UTF8Decoder.GetChars (System.Byte[] bytes, Int32 b                                                                                        yteIndex, Int32 byteCount, System.Char[] chars, Int32 charIndex) [0x00000] in <f                                                                                        ilename unknown>:0
  at System.IO.StreamReader.ReadBuffer () [0x00000] in <filename unknown>:0
  at System.IO.StreamReader.Read (System.Char[] buffer, Int32 index, Int32 count                                                                                        ) [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.ReadTextReader (Int32 remained) [0x00000] in <filen                                                                                        ame unknown>:0
  at Mono.Xml2.XmlTextReader.PeekChar () [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace) [0x00000] in <file                                                                                        name unknown>:0
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
  at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
  at System.Xml.XmlReader.ReadElementString () [0x00000] in <filename unknown>:0                                                                                        
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadPrimitiveVal                                                                                        ue (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename                                                                                         unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadListElement                                                                                         (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, System.Obj                                                                                        ect list, Boolean canCreateInstance) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElemen                                                                                        t (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x00000] in <filename u                                                                                        nknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (Sys                                                                                        tem.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boole                                                                                        an readBySoapOrder) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        eMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x                                                                                        00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanc                                                                                        e (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean                                                                                         checkType) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (Syst                                                                                        em.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkTy                                                                                        pe) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot (System                                                                                        .Xml.Serialization.XmlTypeMapping rootMap) [0x00000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x0                                                                                        0000] in <filename unknown>:0
  at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serializatio                                                                                        n.XmlSerializationReader reader) [0x00000] in <filename unknown>:0

Additional Information:
- The following code works fine in windows
- Attached 2 files for testing
Comment 1 Andrey 2012-12-12 15:57:30 UTC
yml_catalog class and xml file to reproduce bug
https://dl.dropbox.com/u/5414298/Entity.zip
Comment 2 Zoltan Varga 2012-12-22 15:16:07 UTC
-> Sys.Xml for now.
Comment 3 Andrey 2012-12-22 15:43:47 UTC
Zoltan Varga, sorry, what is that mean?
Comment 4 Atsushi Eno 2015-03-17 06:35:16 UTC
This actually looks like UTF8Encoding issue, and we have imported UTF8Encoding from referencesource. So if it is still problematic then it is UPSTREAM (Microsoft).