NicoK commented on a change in pull request #9132: [FLINK-13245][network] Fix 
the bug of file resource leak while canceling partition request
URL: https://github.com/apache/flink/pull/9132#discussion_r306712897
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/PartitionRequestQueue.java
 ##########
 @@ -181,19 +179,18 @@ public void userEventTriggered(ChannelHandlerContext 
ctx, Object msg) throws Exc
                                return;
                        }
 
-                       // Cancel the request for the input channel
+                       // remove reader from queue of available readers
                        int size = availableReaders.size();
                        for (int i = 0; i < size; i++) {
                                NetworkSequenceViewReader reader = 
pollAvailableReader();
-                               if (reader.getReceiverId().equals(toCancel)) {
-                                       reader.releaseAllResources();
-                                       markAsReleased(reader.getReceiverId());
-                               } else {
+                               if (reader != null && 
!reader.getReceiverId().equals(toCancel)) {
                                        registerAvailableReader(reader);
                                }
                        }
 
-                       allReaders.remove(toCancel);
+                       // remove reader from queue of all readers and release 
its resource
+                       NetworkSequenceViewReader toRelease = 
allReaders.remove(toCancel);
 
 Review comment:
   What do you think about adding a `checkState` here for `toRelease != null` 
which would be a bug in the implementation logic?
   Actually, I'm wondering whether this could happen somehow and how we should 
handle this? We could also ignore this (that would be the previous behaviour)...

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to