https://bz.apache.org/bugzilla/show_bug.cgi?id=58963

            Bug ID: 58963
           Summary: OutOfMemoryError while reading some Excel files
           Product: POI
           Version: 3.13-FINAL
          Hardware: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: zmircmir...@gmail.com

Created attachment 33518
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33518&action=edit
sample project + file to reproduce the error

Hi!

Today we received an Excel file which can't be added into the system, because
POI triggers OOM while trying to open it.
The xlsx file has ~300KB and the application -Xmx750m. It does the same with
-Xmx2750m so it's definitely not this.

This OOM happens with both 3.13 and 3.14-beta1.

I will attach a sample maven project + the problematic file called
"eu-triggers-oom.xlsx" available in /src/test/resources

To replicate the issue, just execute the test from class POIExcelOOMNGTest.
I will also a VisualVM memory usage screenshot while running the test.

Here is the stacktrace of the test project:
shouldNotThrowOOMWhileReadingExcel(poi.excel.oom.POIExcelOOMNGTest)  Time
elapsed: 136.287 sec  <<< FAILURE!
org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException
    at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:62)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:465)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:173)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:278)
    at
poi.excel.oom.POIExcelOOMNGTest.shouldNotThrowOOMWhileReadingExcel(POIExcelOOMNGTest.java:12)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
    ... 37 more
Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.apache.xmlbeans.impl.store.CharUtil.allocate(CharUtil.java:397)
    at org.apache.xmlbeans.impl.store.CharUtil.saveChars(CharUtil.java:506)
    at org.apache.xmlbeans.impl.store.CharUtil.saveChars(CharUtil.java:419)
    at org.apache.xmlbeans.impl.store.CharUtil.saveChars(CharUtil.java:489)
    at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.text(Cur.java:2927)
    at
org.apache.xmlbeans.impl.store.Cur$CurLoadContext.stripText(Cur.java:3130)
    at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.text(Cur.java:3143)
    at
org.apache.xmlbeans.impl.store.Locale$SaxHandler.characters(Locale.java:3291)
    at
org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportCdata(Piccolo.java:992)
    at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1290)
    at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1261)
    at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4812)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
    at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
    at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3479)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1277)
    at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1264)
    at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
    at
org.openxmlformats.schemas.spreadsheetml.x2006.main.SstDocument$Factory.parse(Unknown
Source)
    at
org.apache.poi.xssf.model.SharedStringsTable.readFrom(SharedStringsTable.java:119)
    at
org.apache.poi.xssf.model.SharedStringsTable.<init>(SharedStringsTable.java:106)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at
org.apache.poi.xssf.usermodel.XSSFFactory.createDocumentPart(XSSFFactory.java:60)
    at org.apache.poi.POIXMLDocumentPart.read(POIXMLDocumentPart.java:465)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:173)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:278)
    at
poi.excel.oom.POIExcelOOMNGTest.shouldNotThrowOOMWhileReadingExcel(POIExcelOOMNGTest.java:12)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to