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

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

Hisoka-X commented on code in PR #6488:
URL: https://github.com/apache/hadoop/pull/6488#discussion_r1470514489


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java:
##########
@@ -4077,6 +4077,7 @@ private interface StatisticsAggregator<T> {
       STATS_DATA_CLEANER.
           setName(StatisticsDataReferenceCleaner.class.getName());
       STATS_DATA_CLEANER.setDaemon(true);
+      STATS_DATA_CLEANER.setContextClassLoader(null);

Review Comment:
   If the thread relies on the return value of 
`Thread.currentThread().getContextClassLoader()` for logical processing, it may 
encounter NPE, but I checked the corresponding code. This risk should not 
exist. In fact, this is a normal way of handling classloader references in the 
daemon thread. You can refer 
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-7008595
   
   





> 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-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to