Details
-
Bug
-
Status: Open
-
Critical
-
Resolution: Unresolved
-
0.7.2
-
None
-
None
Description
Usage of the File#deleteOnExit hook in the class TempFileStorageProvider causes a memory leak for long-running servers:
public StorageOutputStream createStorageOutputStream() throws IOException { File file = File.createTempFile(prefix, suffix, directory); file.deleteOnExit(); return new TempFileStorageOutputStream(file); }
The JDK keeps a set of File references (even when already deleted) in memory until the JVM exists. This set grows infinitely. Server-side libraries should never call File#deleteOnExit
https://bugs.openjdk.java.net/browse/JDK-4872014
https://bugs.openjdk.java.net/browse/JDK-4513817
class DeleteOnExitHook {
private static LinkedHashSet<String> files = new LinkedHashSet<>();
Attachments
Issue Links
- links to