TanYuxin-tyx commented on code in PR #24688: URL: https://github.com/apache/flink/pull/24688#discussion_r1572099075
########## flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/hybrid/tiered/storage/SortBufferAccumulator.java: ########## @@ -338,11 +365,22 @@ private Buffer requestBuffer() { } private void releaseFreeBuffers() { - freeSegments.forEach(this::recycleBuffer); - freeSegments.clear(); + synchronized (lock) { + isDataBufferReleased = true; + freeSegments.forEach(this::recycleBuffer); + freeSegments.clear(); + } } private void recycleBuffer(MemorySegment memorySegment) { - checkNotNull(bufferRecycler).recycle(memorySegment); + synchronized (lock) { + if (!isDataBufferReleased + && currentDataBuffer != null + && !currentDataBuffer.isReleased()) { + freeSegments.add(memorySegment); Review Comment: Make sense. Added the lock. -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org