cxzl25 commented on code in PR #37015:
URL: https://github.com/apache/spark/pull/37015#discussion_r908351409
##########
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:
Are you referring to adding more comments to the code, or explaining why
this happens in this PR?
Original PR #23989 should explain:
> When TransportChannelHandler processes IdleStateEvent, it first calculates
whether the last request time has timed out.
At this time, TransportClient.sendRpc initiates a request.
TransportChannelHandler gets responseHandler.numOutstandingRequests() > 0,
causing the normal connection to be closed.
--
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]