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_r338958307
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
 ##########
 @@ -205,14 +236,26 @@ public void 
recycleMemorySegments(Collection<MemorySegment> segments) throws IOE
        }
 
        private void recycleMemorySegments(Collection<MemorySegment> segments, 
int size) throws IOException {
+               CompletableFuture<?> toNotify = null;
                synchronized (factoryLock) {
                        numTotalRequiredBuffers -= size;
 
-                       availableMemorySegments.addAll(segments);
+                       synchronized (availabilityHelper) {
 
 Review comment:
   I guess we could migrate the region of `synchronized (availabilityHelper) ` 
out of `synchronized (factoryLock)` to avoid nested lock. I wonder the nested 
lock would bring potential risks future.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to