tillrohrmann commented on a change in pull request #9750:
[FLINK-14139][rest]Fix potential memory leak problem of rest server.
URL: https://github.com/apache/flink/pull/9750#discussion_r327609158
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestServerEndpoint.java
##########
@@ -113,6 +115,15 @@ public RestServerEndpoint(RestServerEndpointConfiguration
configuration) throws
this.responseHeaders = configuration.getResponseHeaders();
terminationFuture = new CompletableFuture<>();
+
+ // the clean up of temp files when jvm exits is handled by
org.apache.flink.util.ShutdownHookUtil; thus,
+ // it's no need to register those files (post chunks and upload
file chunks) to java.io.DeleteOnExitHook
+ // which may lead to memory leak.
+ DiskAttribute.deleteOnExitTemporaryFile = false;
+ DiskFileUpload.deleteOnExitTemporaryFile = false;
+
+ // share the same directory with file upload for post chunks
storage.
+ DiskAttribute.baseDirectory =
uploadDir.normalize().toAbsolutePath().toString();
Review comment:
Is the `DiskAttribute` and `DiskFileUpload` only used by Flink's
`FileUploadHandler`? If yes, would it make sense to move these settings into
the constructor of the `FileUploadHandler`? At the moment we also set the
`DiskFileUpload.baseDirectory` there. That way it would be easier to understand
the context.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services