Bug 65609 - Flush not working
Summary: Flush not working
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 5.0.0-FINAL
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2021-10-01 15:49 UTC by David Juarez
Modified: 2021-10-13 08:36 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description David Juarez 2021-10-01 15:49:19 UTC


- The library gets blocked while writing a large number of rows on an Excel sheet.

Probable reason:

- The method "flushRows" of the class "SXSSFSheet" does not flush anything in the temporary file (File "_fd" of class SheetDataWriter) before the method "close" is called. It just writes the last rows in the Writer ("_out" of class SheetDataWriter).

Solution Suggestion:

public class SXSSFSheet implements Sheet
    public void flushRows() throws IOException

public class SheetDataWriter implements Closeable {
    public void flush() throws IOException {
Comment 1 PJ Fanning 2021-10-01 16:33:02 UTC
Would you be able to try DeferredSXSSFWorkbook (as opposed to SXSSFWorkbook)? This works a bit differently and avoids temp files.
Comment 2 PJ Fanning 2021-10-01 17:06:28 UTC
Instead of changing SXSSFSheet.flushRow(), I've added a new method - SXSSFSheet.flushBufferedData(). This is so that not everyone is affected by a behaviour change, users can choose to call flushBufferedData to see if it helps.
Comment 3 David Juarez 2021-10-01 18:13:47 UTC
Thank you very much for your change. When do you think that the version containing the new feature would be released (at least as beta)?
Comment 4 PJ Fanning 2021-10-01 18:32:01 UTC
The next release is delayed by other incomplete work. You could try DeferredSXSSFWorkbook like I suggested before. There are also CI builds - eg https://ci-builds.apache.org/job/POI/job/POI-DSL-1.8/ (which has not run since my change)
Comment 5 PJ Fanning 2021-10-02 13:04:10 UTC
main change is r1893791
Comment 6 David Juarez 2021-10-13 07:42:13 UTC
Is there a maven central repository available for the snapshots? We are finding problems with the dependencies of the libraries. Is it possible to get the pom.xml files of the libraries?
Comment 7 PJ Fanning 2021-10-13 08:36:57 UTC
We don't publish snapshots to maven. https://dist.apache.org/repos/dist/dev/poi/5.1.0-RC1/maven is where we published a maven compatible version of an RC version of 5.1.0. There were a lot of problems with that RC and we are working towards a new RC. The change for this issue was not in RC1. Still, that link might let you know approximately what the poms look like. There have been changes to the poms since - specifically, to reduce the number of mandatory transitive dependencies.