uranusjr commented on code in PR #69125:
URL: https://github.com/apache/airflow/pull/69125#discussion_r3499881609


##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/Comm.kt:
##########
@@ -72,17 +104,18 @@ class CoordinatorComm(
       return
     }
 
-    val payloadLength = Frame.parseLengthPrefix(prefix)
-    val payload = reader.readByteArray(payloadLength)
-    if (payload.size != payloadLength) { // Something is terribly wrong. Let's 
bail.
-      logger.error(
-        "Payload length not right",
-        mapOf("expect" to payloadLength, "receive" to payload.size),
-      )
-      shutDownRequested = true
-      return
-    }
-    val frame = decode(payload)
+    val declaredLength = Frame.parseLengthPrefix(prefix)
+    val frame =
+      try {
+        Frame.decode(ChannelFrameInput(reader, declaredLength))
+      } catch (e: Exception) {
+        logger.error(
+          "Failed to read or decode frame",
+          mapOf("length" to declaredLength, "exception" to e),
+        )
+        shutDownRequested = true
+        return
+      }

Review Comment:
   I also added some additional handling inside ChannelFrameInput to handle 
cancelling during the read loop.



-- 
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]

Reply via email to