[Bug 61895] New: DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

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

[Bug 61895] New: DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895

            Bug ID: 61895
           Summary: DefaultTempFileCreationStrategy uses
                    File.deleteOnExit() which is a memory leak
           Product: POI
           Version: unspecified
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: POI Overall
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

The DefaultTempFileCreationStrategy uses File.deleteOnExit() which holds on to
temporary files until the JVM exists. This causes the JVM heap size to grow
indefinitely until you run into an OutOfMemory error. More problematically,
this queue of files cannot be cleaned manually. So code that writes to
spreadsheets regularly, MUST restart every once and a while. Hence all
File.deleteOnExit calls should be removed.

See also: https://puneeth.wordpress.com/2006/01/23/filedeleteonexit-is-evil/

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

Reply | Threaded
Open this post in threaded view
|

[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #1 from Dominik Stadler <[hidden email]> ---
Apache POI provides a plugable temp file creation strategy for exactly this, so
you can easily write your own which does not use File.deleteOnExit() and define
it as the strategy to use in your application.

If you succeed and think your approach would be useful for POI overall, then
please share it here.

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

Reply | Threaded
Open this post in threaded view
|

[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895

--- Comment #2 from Jan-Willem Gmelig Meyling <[hidden email]> ---
Would it be an idea to just remove all associated temp files whenever the
workbook gets disposed?

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

Reply | Threaded
Open this post in threaded view
|

[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895

--- Comment #3 from Javen O'Neal <[hidden email]> ---
(In reply to Jan-Willem Gmelig Meyling from comment #2)
> Would it be an idea to just remove all associated temp files whenever the
> workbook gets disposed?

No, because the user may create more than 1 temporary workbook at a time.
Deleting all temporary workbooks would be particularly bad if one of the open
workbooks referenced another workbook in a formula or name reference.
This wouldn't make for a very good default strategy.

As suggested in the JavaDocs, you probably want to implement a
FileCreationStrategy that is better suited to long-running JVM processes (such
as in a Tomcat container). The default strategy is not suitable for your
application. I think this is clear in the documentation.

See bug 59166 comment 4
https://poi.apache.org/apidocs/org/apache/poi/util/TempFileCreationStrategy.html

If you'd like to write a LongRunningJVMFileCreationStrategy class with the
appropriate unit tests, we'd be happy to review and merge it.

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

Reply | Threaded
Open this post in threaded view
|

[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit() which is a memory leak

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #4 from Dominik Stadler <[hidden email]> ---
Closing this issue for now, please reopen if you want to contribute a strategy
that is useful in your case.

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