You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I initially noticed this bug because a third-party REST API returns malformed XML on some occasions, which causes our server to run out of memory.
After a lot of head-scratching I found that an unclosed attribute string in the XML declaration causes this systematically. Here's the simplest example of reproducing the bug that I've found:
$ scalac XMLEventReader_OutOfMemory.scala && scala XMLEventReader_OutOfMemoryException in thread "XMLEventReader" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3332) at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:137) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:121) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:622) at java.lang.StringBuilder.append(StringBuilder.java:202) at scala.collection.mutable.StringBuilder.append(StringBuilder.scala:267) at scala.xml.parsing.MarkupParserCommon.xAttributeValue(MarkupParserCommon.scala:70) at scala.xml.pull.XMLEventReader$Parser.xAttributeValue(XMLEventReader.scala:60) at scala.xml.parsing.MarkupParserCommon.xAttributeValue(MarkupParserCommon.scala:78) at scala.xml.pull.XMLEventReader$Parser.xAttributeValue(XMLEventReader.scala:60) at scala.xml.parsing.MarkupParser.xAttributes(MarkupParser.scala:318) at scala.xml.pull.XMLEventReader$Parser.xAttributes(XMLEventReader.scala:60) at scala.xml.parsing.MarkupParser.xmlProcInstr(MarkupParser.scala:143) at scala.xml.pull.XMLEventReader$Parser.xmlProcInstr(XMLEventReader.scala:60) at scala.xml.parsing.MarkupParser.prologOrTextDecl(MarkupParser.scala:159) at scala.xml.parsing.MarkupParser.prolog(MarkupParser.scala:209) at scala.xml.pull.XMLEventReader$Parser.prolog(XMLEventReader.scala:60) at scala.xml.parsing.MarkupParser.document(MarkupParser.scala:239) at scala.xml.pull.XMLEventReader$Parser.document(XMLEventReader.scala:60) at scala.xml.pull.XMLEventReader$Parser.scala$xml$pull$XMLEventReader$Parser$$$anonfun$2(XMLEventReader.scala:96) at scala.xml.pull.XMLEventReader$Parser$$Lambda$93/1925707867.apply(Unknown Source) at scala.xml.pull.ProducerConsumerIterator.interruptibly(XMLEventReader.scala:125) at scala.xml.pull.XMLEventReader.interruptibly(XMLEventReader.scala:27) at scala.xml.pull.XMLEventReader$Parser.run(XMLEventReader.scala:96) at java.lang.Thread.run(Thread.java:745)
The text was updated successfully, but these errors were encountered:
@dancek if you encounter any problems feel free to send me pull requests; I'd like to maintain my fork at least a little bit until this gets attention by the maintainers.
I initially noticed this bug because a third-party REST API returns malformed XML on some occasions, which causes our server to run out of memory.
After a lot of head-scratching I found that an unclosed attribute string in the XML declaration causes this systematically. Here's the simplest example of reproducing the bug that I've found:
Running the code causes an OutOfMemoryException:
The text was updated successfully, but these errors were encountered: