advancedxy commented on code in PR #428:
URL: https://github.com/apache/incubator-uniffle/pull/428#discussion_r1055026833


##########
server/src/main/java/org/apache/uniffle/server/ShuffleServerGrpcService.java:
##########
@@ -258,6 +255,10 @@ public void sendShuffleData(SendShuffleDataRequest req,
           break;
         }
       }
+      // since the required buffer id is only used once, the shuffle client 
would try to require another buffer whether
+      // current connection succeeded or not. Therefore, the 
preAllocatedBuffer is first get and removed, then after
+      // cacheShuffleData finishes, the preAllocatedSize should be updated 
accordingly.
+      manager.releasePreAllocatedSize(info.getRequireSize());

Review Comment:
   > `info` may be null?
   
   No, info couldn't be null. If it's null, then `isPreAllocated` is false, 
It's already handled in L219 - L232, which has an early return.
   
   > Do we release allocateMemory in any other places? Is there conflicts if we 
release the memory here?
   
   There are only two places to release `preAllocatedSize`
   1. one in 
`org.apache.uniffle.server.ShuffleTaskManager#preAllocatedBufferCheck`
   2. another here
   
   I have rewrote corresponding parts to make sure they don't have race 
conditions. You can take a look at these two places.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to