flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From NicoK <...@git.apache.org>
Subject [GitHub] flink pull request #4581: [FLINK-7499][io] fix double buffer release in Spil...
Date Thu, 23 Nov 2017 16:31:14 GMT
Github user NicoK commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4581#discussion_r152841030
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/ResultPartition.java
---
    @@ -267,28 +268,29 @@ public ResultPartitionType getPartitionType() {
     	 * first buffer has been added.
     	 */
     	public void add(Buffer buffer, int subpartitionIndex) throws IOException {
    -		boolean success = false;
    +		checkNotNull(buffer);
     
     		try {
     			checkInProduceState();
    +		} catch (Throwable t) {
    +			buffer.recycle();
    --- End diff --
    
    Actually, a sanity check for double-recycle comes with #4613 for which I also needed this
PR. It does, however, work differently and only checks that the reference counter does not
go below 0 - I guess, this way we do not put too much pressure on the garbage collector compared
to creating new Buffer instances for each `retain()`


---

Mime
View raw message