You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/02/01 11:51:00 UTC

[jira] [Commented] (HADOOP-19049) Class loader leak caused by StatisticsDataReferenceCleaner thread

    [ https://issues.apache.org/jira/browse/HADOOP-19049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17813180#comment-17813180 ] 

ASF GitHub Bot commented on HADOOP-19049:
-----------------------------------------

steveloughran commented on code in PR #6488:
URL: https://github.com/apache/hadoop/pull/6488#discussion_r1474327653


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileSystemContractBaseTest.java:
##########
@@ -526,6 +526,18 @@ public void testRenameDirectoryMoveToExistingDirectory() throws Exception {
         fs.exists(path(dst + "/subdir/file2")));
   }
 
+  @Test
+  public void testStatisticsDataReferenceCleanerClassLoader() {
+    // initialize the static thread
+    new FileSystem.Statistics("test");
+    Thread.getAllStackTraces().keySet().stream()
+        .filter(t -> t.getName().contains("StatisticsDataReferenceCleaner")).findFirst()
+        .ifPresent(t -> {
+          ClassLoader classLoader = t.getContextClassLoader();
+          assertNull(classLoader);
+        });

Review Comment:
   nice.
   Can you put it in `TestFileSystemStorageStatistics` as I think it is a better home. Putting it in this test suite will actually rerun it multiple times: once per subclass





> Class loader leak caused by StatisticsDataReferenceCleaner thread
> -----------------------------------------------------------------
>
>                 Key: HADOOP-19049
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19049
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: common
>    Affects Versions: 3.3.6
>            Reporter: Jia Fan
>            Priority: Major
>              Labels: pull-request-available
>
> The "org.apache.hadoop.fs.FileSystem$Statistics$StatisticsDataReferenceCleaner" daemon thread was created by FileSystem. 
> This is fine if the thread's context class loader is the system class loader, but it's bad if the context class loader is a custom class loader. The reference held by this daemon thread means that the class loader can never become eligible for GC.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org