You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/09/25 03:31:29 UTC

[GitHub] [flink] wsry commented on a change in pull request #9750: [FLINK-14139][rest]Fix potential memory leak problem of rest server.

wsry 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_r327918636
 
 

 ##########
 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:
   You are right. The DiskAttribute and DiskFileUpload is only used by FileUploadHandler. I will move these settings into the constructor of the FileUploadHandler and update the pr.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services