From 8ac3d5fce638ef87c9cc61b64676c6f641c147fa Mon Sep 17 00:00:00 2001 From: Justin Siek Date: Mon, 8 Jun 2026 16:42:38 -0700 Subject: [PATCH] fix(storage): close Files.walk stream in deleteRepo to stop leak --- .../dataset/GitVersionControlLocalFileStorage.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java index 72566dd2d70..9208bad126a 100644 --- a/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java +++ b/common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/util/dataset/GitVersionControlLocalFileStorage.java @@ -78,10 +78,12 @@ public static void removeFileFromRepo(Path repoPath, Path filePath) throws IOExc * @throws IOException If an I/O error occurs. */ public static void deleteRepo(Path directoryPath) throws IOException { - Files.walk(directoryPath) - .sorted(Comparator.reverseOrder()) - .map(Path::toFile) - .forEach(File::delete); + try (var stream = Files.walk(directoryPath)) { + stream + .sorted(Comparator.reverseOrder()) + .map(Path::toFile) + .forEach(File::delete); + } } /**