Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/4238#discussion_r125219368 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java --- @@ -255,8 +403,39 @@ public int getPort() { return serverAddress.getPort(); } + /** + * Cleans up BLOBs which are not referenced anymore. + */ + @Override + public void run() { + synchronized (lockObject) { + Iterator<Map.Entry<JobID, RefCount>> entryIter = jobRefCounters.entrySet().iterator(); + + while (entryIter.hasNext()) { + Map.Entry<JobID, RefCount> entry = entryIter.next(); + RefCount ref = entry.getValue(); + + if (ref.references <= 0 && System.currentTimeMillis() >= ref.keepUntil) { + JobID jobId = entry.getKey(); + + final File localFile = + new File(BlobUtils.getStorageLocationPath(storageDir.getAbsolutePath(), jobId)); + try { + FileUtils.deleteDirectory(localFile); + // let's only remove this directory from cleanup if the cleanup was successful + entryIter.remove(); + } catch (Throwable t) { + LOG.warn("Failed to locally delete job directory {}", localFile.getAbsolutePath()); --- End diff -- Swallowing of exception
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---