pnowojski commented on a change in pull request #8290: [FLINK-12070] [network] 
Implement new bounded blocking subpartitions
URL: https://github.com/apache/flink/pull/8290#discussion_r279645087
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/partition/consumer/SingleInputGate.java
 ##########
 @@ -565,7 +565,13 @@ public void requestPartitions() throws IOException, 
InterruptedException {
                        return Optional.of(new BufferOrEvent(buffer, 
currentChannel.getChannelIndex(), moreAvailable));
                }
                else {
-                       final AbstractEvent event = 
EventSerializer.fromBuffer(buffer, getClass().getClassLoader());
+                       final AbstractEvent event;
+                       try {
+                               event = EventSerializer.fromBuffer(buffer, 
getClass().getClassLoader());
+                       }
+                       finally {
+                               buffer.recycleBuffer();
 
 Review comment:
   Can you add a test coverage for this?  It might be quite east to add 
`assertTrue(buffer.isRecycled()` assertion(s) at the end of 
`SingleInputGateTest#testBasicGetNextLogic()`:
   1. maybe manually checking that buffer created by 
`inputChannels[0].readEndOfPartitionEvent();` was recycled or ...
   2. ...
   a. recycle non event buffers in `verifyBufferOrEvent(...)`
   b. and add general assertion to `TestInputChannel` whether all buffers were 
recycled?

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