TanYuxin-tyx commented on code in PR #22958:
URL: https://github.com/apache/flink/pull/22958#discussion_r1254019372


##########
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/HashSubpartitionBufferAccumulator.java:
##########
@@ -68,17 +83,32 @@ public HashSubpartitionBufferAccumulator(
     // ------------------------------------------------------------------------
 
     public void append(ByteBuffer record, Buffer.DataType dataType) throws 
IOException {
-        if (dataType.isEvent()) {
-            writeEvent(record, dataType);
-        } else {
-            writeRecord(record, dataType);
+        synchronized (lock) {
+            if (isReleased) {
+                return;
+            }
+            if (dataType.isEvent()) {
+                writeEvent(record, dataType);
+            } else {
+                writeRecord(record, dataType);
+            }
         }
     }
 
+    /** This method can only be called by the task thread. */
     public void close() {
+        recycleBuffers();
         checkState(unfinishedBuffers.isEmpty(), "There are unfinished 
buffers.");
     }
 
+    public void release() {

Review Comment:
   @reswqa Good catch! This idea can significantly simplify the fix.



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