aajisaka commented on a change in pull request #3677:
URL: https://github.com/apache/hadoop/pull/3677#discussion_r758074550



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/datatransfer/sasl/SaslDataTransferClient.java
##########
@@ -603,7 +603,17 @@ private IOStreamPair doSaslHandshake(InetAddress addr,
           conf, cipherOption, underlyingOut, underlyingIn, false) :
           sasl.createStreamPair(out, in);
     } catch (IOException ioe) {
-      sendGenericSaslErrorMessage(out, ioe.getMessage());
+      try {

Review comment:
       I could reproduce the test failure by closing `out` before sending error.
   ```
       } catch (IOException ioe) {
         out.close();
         sendGenericSaslErrorMessage(out, ioe.getMessage());
         throw ioe;
       }
   ```
   Throwing the original exception as follows fixed the test case. Therefore 
your fix is really helpful.
   ```
       } catch (IOException ioe) {
         out.close();
         try {
           sendGenericSaslErrorMessage(out, ioe.getMessage());
         } catch (Exception e) {
           ioe.addSuppressed(e);
         }
         throw ioe;
       }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



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

Reply via email to