Izeren commented on code in PR #27624:
URL: https://github.com/apache/flink/pull/27624#discussion_r2816731122


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/BufferManager.java:
##########
@@ -216,6 +221,10 @@ public void recycle(MemorySegment segment) {
                 if (inputChannel.isReleased()) {
                     
globalPool.recycleUnpooledMemorySegments(Collections.singletonList(segment));
                     return;
+                } else if (inputChannel.hasError()) {
+                    LOG.warn("Input channel has errors - recycling the 
buffer");
+                    
globalPool.recycleUnpooledMemorySegments(Collections.singletonList(segment));

Review Comment:
   For my understanding, does every segment have only 1 input channel? 
   Can it happen that we would call `recycleUnpooledMemorySegments` on the same 
segment twice? If yes, is this call idempotent?



##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/InputChannel.java:
##########
@@ -346,6 +346,11 @@ public long unsynchronizedGetSizeOfQueuedBuffers() {
      */
     public void notifyRequiredSegmentId(int subpartitionId, int segmentId) 
throws IOException {}
 
+    /** Whether this input channel has encountered error. */
+    public boolean hasError() {
+        return cause.get() != null;

Review Comment:
   If it is not too complicated would be good to write a dedicated unit test 
for new public method



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