You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2017/12/13 12:05:17 UTC
[Bug 61895] New: DefaultTempFileCreationStrategy uses
File.deleteOnExit() which is a memory leak
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: dev@poi.apache.org
Reporter: janwillem.meyling@athenastudies.nl
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit()
which is a memory leak
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895
--- Comment #3 from Javen O'Neal <on...@apache.org> ---
(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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit()
which is a memory leak
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |WORKSFORME
--- Comment #4 from Dominik Stadler <do...@gmx.at> ---
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit()
which is a memory leak
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61895] DefaultTempFileCreationStrategy uses File.deleteOnExit()
which is a memory leak
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61895
--- Comment #2 from Jan-Willem Gmelig Meyling <ja...@athenastudies.nl> ---
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org