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_r306727097
 
 

 ##########
 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:
   If we decided to ignore non-existing readers, we may actually also consider 
removing the `PartitionRequestQueue#released` member (lower memory footprint) 
at the cost of having to go through the list of all `availableReaders` again 
for such (probably rare) cases.

----------------------------------------------------------------
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