zhijiangW commented on a change in pull request #9993: 
[FLINK-14498][runtime]Introduce NetworkBufferPool#isAvailable() for interacting 
with LocalBufferPool.
URL: https://github.com/apache/flink/pull/9993#discussion_r340990425
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
 ##########
 @@ -170,9 +180,13 @@ public void recycle(MemorySegment segment) {
                                        throw new IllegalStateException("Buffer 
pool is destroyed.");
                                }
 
-                               final MemorySegment segment = 
availableMemorySegments.poll(2, TimeUnit.SECONDS);
-                               if (segment != null) {
-                                       segments.add(segment);
+                               synchronized (availabilityHelper) {
 
 Review comment:
   If it is not very easy to integrate the locks atm, we might focus on this 
issue in a separate ticket future, although i agree the codes seem a bit ugly 
to have to separate locks.
   
   Although i have not thought all the cases through, I guess it is not very 
easy to consider completely to avoid potential risks in short time.

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