OAK-12062 : fixed NPE while uploading metadata for AWS S3#2688
OAK-12062 : fixed NPE while uploading metadata for AWS S3#2688rishabhdaim merged 2 commits intotrunkfrom
Conversation
|
I'm a bit concerned that we have an File leak; Deleting the File after use should be sufficient. |
| tempFile.deleteOnExit(); // Clean up after JVM exits | ||
| // we have to read all the stream to get the actual length | ||
| // last else block: store to temp file and re-read | ||
| final File tempFile = File.createTempFile("inputstream-", ".tmp"); |
There was a problem hiding this comment.
Prefix should show which class created the temp file.
There was a problem hiding this comment.
How is it addressed? I do not see where "delete()" is called. It is still only calling "deleteOnExit()", which will not delete immediately.
| // we have to read all the stream to get the actual length | ||
| // last else block: store to temp file and re-read | ||
| final File tempFile = File.createTempFile("inputstream-", ".tmp"); | ||
| tempFile.deleteOnExit(); // Clean up after JVM exits |
There was a problem hiding this comment.
This will delete on exit, but not delete after reading. I would delete after reading as well, so that in the normal case (where the process is not killed) the file is deleted. Otherwise we might have a large number of temp files, if the process is not terminated for a long time.
(This could cause out-of-disk space, and if the number of files is huge, also out-of-memory in kubernetes)
|


No description provided.