wsry commented on a change in pull request #13924: URL: https://github.com/apache/flink/pull/13924#discussion_r601057131
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/SortMergeSubpartitionReader.java ########## @@ -176,21 +202,28 @@ public void resumeConsumption() { @Override public Throwable getFailureCause() { - // we can never throw an error after this was created - return null; + synchronized (lock) { + return failureCause; + } } @Override public boolean isAvailable(int numCreditsAvailable) { - if (numCreditsAvailable > 0) { - return !buffersRead.isEmpty(); - } + synchronized (lock) { + if (isReleased) { + return true; + } - return !buffersRead.isEmpty() && !buffersRead.peek().isBuffer(); + if (numCreditsAvailable > 0) { + return !buffersRead.isEmpty(); + } + + return !buffersRead.isEmpty() && !buffersRead.peek().isBuffer(); + } } @Override public int unsynchronizedGetNumberOfQueuedBuffers() { Review comment: This method is only for metric. I agree we should add some java doc to methods of ResultSubpartitionView. But that is out of the scope of this PR. Maybe we can do the improvement in another PR in the future. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org