POI 4.0 SXSSF: This archive contains unclosed entries

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

POI 4.0 SXSSF: This archive contains unclosed entries

Andreas Reichel
Dear All,

the new 4.0 seems to have a problem when writing large XLSX files (e.g.
>100k rows but less than 1 Mill. rows) using SXSSFWorkbook:

java.io.IOException: This archive contains unclosed entries.
        at
org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.finish
(ZipArchiveOutputStream.java:467)
        at
org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.ja
va:406)
        at
org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:93
6)

Please note, small files (e.g. less than 100k rows seem to work fine)
and also everything works fine with 3.18 (same code, same data).
Also, other people seem to have this problem:
https://stackoverflow.com/questions/53080171/java-apache-poi-and-large-result-set-from-db2-runs-into-exception

My suspision is that the Workbook is closed before the ZIP stream is
ready?
Thank you already for helping, best regards

Andreas

Reply | Threaded
Open this post in threaded view
|

Re: POI 4.0 SXSSF: This archive contains unclosed entries

Andreas Reichel
We have tested our particular use case 3 times each with 4.0 and 3.17
(exactly the same code, exactly the same data). While 3.17 works w/o
any adjustments, 4.0 throws this error and leaves an invalid XLSX file.
Best regardsAndreas
On Wed, 2018-10-31 at 18:42 +0700, Andreas Reichel wrote:

> Dear All,
> the new 4.0 seems to have a problem when writing large XLSX files
> (e.g. >100k rows but less than 1 Mill. rows) using SXSSFWorkbook:
> java.io.IOException: This archive contains unclosed
> entries.        at
> org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.fini
> sh(ZipArchiveOutputStream.java:467)        at
> org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.
> java:406)        at
> org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:
> 936)
> Please note, small files (e.g. less than 100k rows seem to work fine)
> and also everything works fine with 3.18 (same code, same data).Also,
> other people seem to have this problem:
> https://stackoverflow.com/questions/53080171/java-apache-poi-and-large-result-set-from-db2-runs-into-exception
> My suspision is that the Workbook is closed before the ZIP stream is
> ready?Thank you already for helping, best regards
> Andreas
>
Reply | Threaded
Open this post in threaded view
|

Re: POI 4.0 SXSSF: This archive contains unclosed entries

Dominik Stadler
Hi,

Thanks for the report, sounds like a problem introduced by moving from
pure-Java ZIP to the ZIP-classes from commons-compress (this was necessary
for Zip-Bomb-Protection with newer Java versions).

However I could not reproduce this with a quick test, also our default
performance-test in class SSPerformanceTest does not show this problem when
called with "SXSSF 300000 20 1", so there seems to be something more that
is needed to trigger the exception.

Maybe you are closing something too early here, e.g. the workbook itself?

If you can provide a ready-to-run sample then please open a bug-report at
https://bz.apache.org/bugzilla/ and include some code that you use to
trigger this?

Thanks... Dominik.

On Wed, Oct 31, 2018 at 3:08 PM Andreas Reichel <
[hidden email]> wrote:

> We have tested our particular use case 3 times each with 4.0 and 3.17
> (exactly the same code, exactly the same data). While 3.17 works w/o
> any adjustments, 4.0 throws this error and leaves an invalid XLSX file.
> Best regardsAndreas
> On Wed, 2018-10-31 at 18:42 +0700, Andreas Reichel wrote:
> > Dear All,
> > the new 4.0 seems to have a problem when writing large XLSX files
> > (e.g. >100k rows but less than 1 Mill. rows) using SXSSFWorkbook:
> > java.io.IOException: This archive contains unclosed
> > entries.        at
> > org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.fini
> > sh(ZipArchiveOutputStream.java:467)        at
> > org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.
> > java:406)        at
> > org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:
> > 936)
> > Please note, small files (e.g. less than 100k rows seem to work fine)
> > and also everything works fine with 3.18 (same code, same data).Also,
> > other people seem to have this problem:
> >
> https://stackoverflow.com/questions/53080171/java-apache-poi-and-large-result-set-from-db2-runs-into-exception
> > My suspision is that the Workbook is closed before the ZIP stream is
> > ready?Thank you already for helping, best regards
> > Andreas
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: POI 4.0 SXSSF: This archive contains unclosed entries

Andreas Reichel
Thank you very much Dominik, I have captured the bug report 62872 with
a very simple test case.Best regards and cheers
Andreas
On Wed, 2018-10-31 at 20:09 +0100, Dominik Stadler wrote:

> Hi,
> Thanks for the report, sounds like a problem introduced by moving
> frompure-Java ZIP to the ZIP-classes from commons-compress (this was
> necessaryfor Zip-Bomb-Protection with newer Java versions).
> However I could not reproduce this with a quick test, also our
> defaultperformance-test in class SSPerformanceTest does not show this
> problem whencalled with "SXSSF 300000 20 1", so there seems to be
> something more thatis needed to trigger the exception.
> Maybe you are closing something too early here, e.g. the workbook
> itself?
> If you can provide a ready-to-run sample then please open a bug-
> report athttps://bz.apache.org/bugzilla/ and include some code that
> you use totrigger this?
> Thanks... Dominik.
> On Wed, Oct 31, 2018 at 3:08 PM Andreas Reichel <
> [hidden email]> wrote:
> > We have tested our particular use case 3 times each with 4.0 and
> > 3.17(exactly the same code, exactly the same data). While 3.17
> > works w/oany adjustments, 4.0 throws this error and leaves an
> > invalid XLSX file.Best regardsAndreasOn Wed, 2018-10-31 at 18:42
> > +0700, Andreas Reichel wrote:
> > > Dear All,the new 4.0 seems to have a problem when writing large
> > > XLSX files(e.g. >100k rows but less than 1 Mill. rows) using
> > > SXSSFWorkbook:java.io.IOException: This archive contains
> > > unclosedentries.        atorg.apache.commons.compress.archivers.z
> > > ip.ZipArchiveOutputStream.finish(ZipArchiveOutputStream.java:467)
> > >         atorg.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(
> > > SXSSFWorkbook.java:406)        atorg.apache.poi.xssf.streaming.SX
> > > SSFWorkbook.write(SXSSFWorkbook.java:936)Please note, small files
> > > (e.g. less than 100k rows seem to work fine)and also everything
> > > works fine with 3.18 (same code, same data).Also,other people
> > > seem to have this problem:
> > https://stackoverflow.com/questions/53080171/java-apache-poi-and-large-result-set-from-db2-runs-into-exception
> > > My suspision is that the Workbook is closed before the ZIP stream
> > > isready?Thank you already for helping, best regardsAndreas