Github user NicoK commented on a diff in the pull request: https://github.com/apache/flink/pull/4552#discussion_r161296711 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SpilledSubpartitionView.java --- @@ -73,6 +73,9 @@ /** Flag indicating whether all resources have been released. */ private AtomicBoolean isReleased = new AtomicBoolean(); + /** The next buffer to hand out. */ + private Buffer nextBuffer; --- End diff -- We need to protect this against race conditions with respect to `releaseAllResources()` as well. Actually, I'm surprised that nothing in this class is protected against concurrently releasing it. Although I have created a separate issue for this ([FLINK-8425](https://issues.apache.org/jira/browse/FLINK-8425)), I think we may need to solve this here for the new `nextBuffer` anyway.
---