You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "goiri (via GitHub)" <gi...@apache.org> on 2023/02/08 19:52:47 UTC

[GitHub] [hadoop] goiri commented on a diff in pull request #5371: HDFS-18324. Fix race condition in closing IPC connections.

goiri commented on code in PR #5371:
URL: https://github.com/apache/hadoop/pull/5371#discussion_r1100608662


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -1159,29 +1159,35 @@ public void run() {
      */
     public void sendRpcRequest(final Call call)
         throws InterruptedException, IOException {
-      if (shouldCloseConnection.get()) {
-        return;
-      }
-
-      // Serialize the call to be sent. This is done from the actual
-      // caller thread, rather than the rpcRequestThread in the connection,
-      // so that if the serialization throws an error, it is reported
-      // properly. This also parallelizes the serialization.
-      //
-      // Format of a call on the wire:
-      // 0) Length of rest below (1 + 2)
-      // 1) RpcRequestHeader  - is serialized Delimited hence contains length
-      // 2) RpcRequest
-      //
-      // Items '1' and '2' are prepared here. 
-      RpcRequestHeaderProto header = ProtoUtil.makeRpcRequestHeader(
-          call.rpcKind, OperationProto.RPC_FINAL_PACKET, call.id, call.retry,
-          clientId, call.alignmentContext);
+      if (!shouldCloseConnection.get()) {

Review Comment:
   Why can't we do early exit like in the existing code?
   I understand the while loop with the offer to avoid the race condition but the early return should be fine, right?



-- 
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: common-issues-unsubscribe@hadoop.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org