You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/06/28 11:04:06 UTC

[GitHub] [spark] weixiuli commented on a diff in pull request #37015: [SPARK-39628][CORE] Fix a race condition when handling of IdleStateEvent again

weixiuli commented on code in PR #37015:
URL: https://github.com/apache/spark/pull/37015#discussion_r908345107


##########
common/network-common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java:
##########
@@ -158,10 +158,12 @@ public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exc
       // To avoid a race between TransportClientFactory.createClient() and this code which could
       // result in an inactive client being returned, this needs to run in a synchronized block.
       synchronized (this) {
+        // Do not modify the order of hasInFlightRequests and isActuallyOverdue (see SPARK-27073)
+        boolean hasInFlightRequests = responseHandler.hasOutstandingRequests();
         boolean isActuallyOverdue =
           System.nanoTime() - responseHandler.getTimeOfLastRequestNs() > requestTimeoutNs;
         if (e.state() == IdleState.ALL_IDLE && isActuallyOverdue) {
-          if (responseHandler.hasOutstandingRequests()) {
+          if (hasInFlightRequests) {

Review Comment:
   Could you explain why "Do not modify the order of hasInFlightRequests and isActuallyOverdue " please ?



-- 
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-unsubscribe@spark.apache.org

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


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