johnyangk commented on a change in pull request #223: [NEMO-388] Off-heap 
memory management (reuse ByteBuffer)
URL: https://github.com/apache/incubator-nemo/pull/223#discussion_r310453227
 
 

 ##########
 File path: 
runtime/executor/src/main/java/org/apache/nemo/runtime/executor/bytetransfer/ByteOutputContext.java
 ##########
 @@ -247,8 +246,24 @@ private void writeDataFrame(final Object body, final long 
length) throws IOExcep
         throw new IOException("Stream already closed.");
       }
       
channel.writeAndFlush(DataFrameEncoder.DataFrame.newInstance(getContextId(), 
body, length, newSubStream))
+        .addListener((ChannelFutureListener) future -> {
+          if (future.isSuccess()) {
+            if (partitionToRelease != null) {
 
 Review comment:
   There's potentially a race condition here: `partitionToRelease` is set after 
`channel.writeAndFlush`.
   If `writeAndFlush` completes quickly, then this listener can be invoked 
before `partitionToRelease` is set, in which case it fails to release the 
partition.

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