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

            Bug ID: 64879
           Summary: SXSSFSheet dispose() fails to remove Temporary files
                    for java.io.IOException: No space left on device
           Product: POI
           Version: unspecified
          Hardware: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: SXSSF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 37549
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37549&action=edit
Exception stack trace

The SXSSFSheet has a bug where it will fail to delete the temporary file it has
created when the file system runs out of space. 

I found this problem when creating a very large excel workbook using
SXSSFWorkbook. Attempting to write a new row fails (no space left), my code
then attempts to cleanup by calling dispose(). This fails because the workbook
attempts to flush before disposing and the flush fails with same IOException
(no space left). The large amount of disk space consumed by the temporary file
is only freed up when the program exits. I have attached a screenshot with the
stack trace.

Here is the code in question (poi-ooxml-4.1.2)

https://github.com/apache/poi/blob/trunk/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java#L1910

    boolean dispose() throws IOException {
        if (!allFlushed) {
            flushRows();
        }
        return _writer.dispose();
    }

I suggest this be changed so that the writer.dispose() is always called.

    boolean dispose() throws IOException {
        try {
            if (!allFlushed) {
                flushRows();
            }
        } finally {
            return _writer.dispose();
        }
    }

Let me know if you have any more questions.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to