smattheis commented on a change in pull request #18865:
URL: https://github.com/apache/flink/pull/18865#discussion_r812079724



##########
File path: 
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPoolTest.java
##########
@@ -637,13 +672,17 @@ public void go() throws Exception {
                                             numberOfSegmentsToRequest));
                         }
                     };
-            asyncRequest.start();
 
             // recycle 5 segments
             CompletableFuture<?> availableFuture = 
globalPool.getAvailableFuture();
             globalPool.recycleUnpooledMemorySegments(segments1);
             assertTrue(availableFuture.isDone());
 
+            // Starting to requesting next segments only after previous 
segments were release
+            // otherwise the race condition between requesting new segments 
and releasing old ones
+            // are possible:
+            asyncRequest.start();

Review comment:
       In addition, isn't the use of ArrayList in a concurrent thread 
non-thread-safe? (CopyOnWriteArrayList would be a thread-safe alternative.)




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


Reply via email to