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

            Bug ID: 59312
           Summary: [PATCH] SXSSF does not clean temporary files on
                    .dispose() reliably
           Product: POI
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: SXSSF
          Assignee: [email protected]
          Reporter: [email protected]

The offending function is here:

https://github.com/apache/poi/blob/d94ff1aa8e92b443e06008c35e49a6d1f5f891ea/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java#L378

    boolean dispose() throws IOException {
        _out.close();
        return _fd.delete();
    }

The problem is when _out.close() throws an exception, the file handle is never
deleted, and to my knowledge there is no way for an outside library user to
EVER delete the file?

I suggest the function be changed like so:

    boolean dispose() throws IOException {
        final boolean ret;
        try {
            _out.close();
        } finally {
            ret = _fd.delete();
        }
        return ret;
    }

The way I stumbled upon this bug and what causes it to be a blocking issue is
our /tmp is a tmpfs mount with a 2 gigabyte size limit, temporary compression
was turned off and SXSSF created a temporary .xml file that filled up the 2
gigabyte limit on /tmp, an exception was thrown from .flush() that the drive
was out of space, and when .dispose() was called in a finally block it did not
delete the file, causing all subsequent runs of SXSSF to fail in the same way
since the drive was still full.

If I can provide more info or help please let me know. Thanks!

-- 
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