Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9227#discussion_r44058739
  
    --- Diff: 
network/common/src/main/java/org/apache/spark/network/server/TransportChannelHandler.java
 ---
    @@ -109,18 +109,22 @@ public void channelRead0(ChannelHandlerContext ctx, 
Message request) {
       public void userEventTriggered(ChannelHandlerContext ctx, Object evt) 
throws Exception {
         if (evt instanceof IdleStateEvent) {
           IdleStateEvent e = (IdleStateEvent) evt;
    -      // See class comment for timeout semantics. In addition to ensuring 
we only timeout while
    -      // there are outstanding requests, we also do a secondary 
consistency check to ensure
    -      // there's no race between the idle timeout and incrementing the 
numOutstandingRequests.
    -      boolean hasInFlightRequests = 
responseHandler.numOutstandingRequests() > 0;
           boolean isActuallyOverdue =
             System.nanoTime() - responseHandler.getTimeOfLastRequestNs() > 
requestTimeoutNs;
    -      if (e.state() == IdleState.ALL_IDLE && hasInFlightRequests && 
isActuallyOverdue) {
    -        String address = NettyUtils.getRemoteAddress(ctx.channel());
    -        logger.error("Connection to {} has been quiet for {} ms while 
there are outstanding " +
    -          "requests. Assuming connection is dead; please adjust 
spark.network.timeout if this " +
    -          "is wrong.", address, requestTimeoutNs / 1000 / 1000);
    -        ctx.close();
    +      if (e.state() == IdleState.ALL_IDLE && isActuallyOverdue) {
    +        if (responseHandler.numOutstandingRequests() > 0) {
    +          // In addition to ensuring we only timeout while there are 
outstanding requests, we also
    --- End diff --
    
    I think this comment is confusing and we should remove it. It's not clear 
what's the "secondary check" here and I don't see how this avoids any races.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to