Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6238#discussion_r199811207
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
 ---
    @@ -151,7 +151,12 @@ public void recycle(MemorySegment segment) {
     
                        this.numTotalRequiredBuffers += numRequiredBuffers;
     
    -                   redistributeBuffers();
    +                   try {
    +                           redistributeBuffers();
    +                   } catch (Throwable t) {
    +                           this.numTotalRequiredBuffers -= 
numRequiredBuffers;
    +                           ExceptionUtils.rethrowIOException(t);
    --- End diff --
    
    Shouldn't we also do a clean up of the `LocalBufferPool` in 
`createBufferPool` if the `redistributeBuffers` fails there? 
    ```
    try {
        redistributeBuffers();
    } catch (IOException e) {
        destroyBufferPool(localBufferPool);
        ExceptionUtils.rethrowIOException(e);
    }
    
    return localBufferPool;
    ```


---

Reply via email to