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

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

deepujain commented on code in PR #8303:
URL: https://github.com/apache/hadoop/pull/8303#discussion_r2907254825


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java:
##########
@@ -663,7 +663,17 @@ public static <InstanceT> InstanceT 
getInstanceFromReflection(String className,
     try {
       ClassLoader classLoader;
       if (conf != null) {
-        classLoader = conf.getClassLoader();
+        if (conf.getBoolean(AWS_S3_CLASSLOADER_ISOLATION,
+            DEFAULT_AWS_S3_CLASSLOADER_ISOLATION)) {
+          classLoader = conf.getClassLoader();
+        } else {
+          ClassLoader confLoader = conf.getClassLoader();
+          classLoader = (confLoader != null) ? confLoader
+              : Thread.currentThread().getContextClassLoader();
+        }
+        if (classLoader == null) {
+          classLoader = S3AUtils.class.getClassLoader();
+        }

Review Comment:
   the implementation was simplified to always use conf.getClassLoader() when 
conf != null, since the Configuration’s classloader is set by the caller and is 
never null.



##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java:
##########
@@ -663,7 +663,17 @@ public static <InstanceT> InstanceT 
getInstanceFromReflection(String className,
     try {
       ClassLoader classLoader;
       if (conf != null) {
-        classLoader = conf.getClassLoader();
+        if (conf.getBoolean(AWS_S3_CLASSLOADER_ISOLATION,
+            DEFAULT_AWS_S3_CLASSLOADER_ISOLATION)) {
+          classLoader = conf.getClassLoader();
+        } else {

Review Comment:
   the implementation was simplified to always use conf.getClassLoader() when 
conf != null, since the Configuration’s classloader is set by the caller and is 
never null.





> fs.s3a.classloader.isolation=false configuration does not work - classloader 
> not retrieved from Configuration object
> --------------------------------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-19833
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19833
>             Project: Hadoop Common
>          Issue Type: Bug
>    Affects Versions: 3.4.0, 3.5.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5.1
>            Reporter: Yunzhao Yang
>            Priority: Minor
>              Labels: pull-request-available
>             Fix For: 3.4.0, 3.5.0, 3.4.1, 3.4.2, 3.4.3, 3.4.4, 3.5.1
>
>
> The configuration {{fs.s3a.classloader.isolation=false (introduced from 
> https://issues.apache.org/jira/browse/HADOOP-18993)}} does not work as 
> intended. While the configuration is correctly set in the Hadoop 
> Configuration object, the S3A classloader is never retrieved from the Hadoop 
> Configuration object, resulting in classloader isolation always being enabled 
> regardless of the {{fs.s3a.classloader.isolation}} value.
>  
> The bug occurs in two steps:
> *Configuration is set correctly* - The isolation flag is properly stored in 
> the Hadoop Configuration object. Code link: 
> [https://github.com/apache/hadoop/blob/release-3.5.0-RC0/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java#L1756]
>  
> *Classloader is not retrieved from Configuration* - When creating instances, 
> the classloader is not read from the Configuration object, instead it is 
> always using the S3AUtils's classloader. Code link: 
> [https://github.com/apache/hadoop/blob/release-3.5.0-RC0/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AUtils.java#L660]
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to