You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sl...@apache.org on 2024/02/10 23:21:15 UTC
(hadoop) branch branch-3.4.0 updated: HADOOP-19049. Fix StatisticsDataReferenceCleaner classloader leak (#6488)
This is an automated email from the ASF dual-hosted git repository.
slfan1989 pushed a commit to branch branch-3.4.0
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.4.0 by this push:
new d6c66f76aeb1 HADOOP-19049. Fix StatisticsDataReferenceCleaner classloader leak (#6488)
d6c66f76aeb1 is described below
commit d6c66f76aeb17a9033197b56b278f3dd5d33b67c
Author: Jia Fan <fa...@qq.com>
AuthorDate: Sat Feb 3 22:48:52 2024 +0800
HADOOP-19049. Fix StatisticsDataReferenceCleaner classloader leak (#6488)
Contributed by Jia Fan
---
.../src/main/java/org/apache/hadoop/fs/FileSystem.java | 1 +
.../org/apache/hadoop/fs/TestFileSystemStorageStatistics.java | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
index 0213772ab6a5..768fd5b5e1ca 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java
@@ -4077,6 +4077,7 @@ public abstract class FileSystem extends Configured
STATS_DATA_CLEANER.
setName(StatisticsDataReferenceCleaner.class.getName());
STATS_DATA_CLEANER.setDaemon(true);
+ STATS_DATA_CLEANER.setContextClassLoader(null);
STATS_DATA_CLEANER.start();
}
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemStorageStatistics.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemStorageStatistics.java
index e99f0f2348b3..5710049afb10 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemStorageStatistics.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestFileSystemStorageStatistics.java
@@ -34,6 +34,7 @@ import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
/**
* This tests basic operations of {@link FileSystemStorageStatistics} class.
@@ -102,6 +103,14 @@ public class TestFileSystemStorageStatistics {
}
}
+ @Test
+ public void testStatisticsDataReferenceCleanerClassLoader() {
+ Thread thread = Thread.getAllStackTraces().keySet().stream()
+ .filter(t -> t.getName().contains("StatisticsDataReferenceCleaner")).findFirst().get();
+ ClassLoader classLoader = thread.getContextClassLoader();
+ assertNull(classLoader);
+ }
+
/**
* Helper method to retrieve the specific FileSystem.Statistics value by name.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org