mridulm commented on code in PR #46506:
URL: https://github.com/apache/spark/pull/46506#discussion_r1595887602


##########
common/network-common/src/main/java/org/apache/spark/network/client/TransportClientFactory.java:
##########
@@ -169,8 +169,10 @@ public TransportClient createClient(String remoteHost, int 
remotePort, boolean f
       // this code was able to update things.
       TransportChannelHandler handler = cachedClient.getChannel().pipeline()
         .get(TransportChannelHandler.class);
-      synchronized (handler) {
-        handler.getResponseHandler().updateTimeOfLastRequest();
+      if (handler != null) {

Review Comment:
   `synchronized` will throw an NPE if called on `null` - and `handler` is a 
local variable at this point, so the `null` check should be fine.
   
   This should be a fairly rare occurrence - if I am not wrong, this is due to 
socket close between the `isActive` call and the subsequent 
`pipeline().get(TransportChannelHandler.class)` call - but agree with 
@dongjoon-hyun, we have to make sure the exception is at the `sychronized` 
statement itself : which version was this observed against ?
   
   I am fine with the change, assuming @dongjoon-hyun does not have concerns.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to