Github user NicoK commented on a diff in the pull request: https://github.com/apache/flink/pull/4581#discussion_r152342531 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpillableSubpartitionView.java --- @@ -108,11 +108,7 @@ int releaseMemory() throws IOException { for (int i = 0; i < numBuffers; i++) { Buffer buffer = buffers.remove(); spilledBytes += buffer.getSize(); - try { - spillWriter.writeBlock(buffer); - } finally { - buffer.recycle(); - } + spillWriter.writeBlock(buffer); --- End diff -- Actually, if I see this correctly, here the original code is wrong since it is already recycling a buffer which was added to an asynchronous file write operation. This would lead to data corruption if the buffer is re-used in the meanwhile, wouldn't it?!
---