pnowojski commented on a change in pull request #8925: [FLINK-12852][network] 
Fix the deadlock occured when requesting exclusive buffers
URL: https://github.com/apache/flink/pull/8925#discussion_r302387828
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
 ##########
 @@ -177,7 +193,8 @@ public void recycle(MemorySegment segment) {
 
                final List<MemorySegment> segments = new 
ArrayList<>(numberOfSegmentsToRequest);
                try {
-                       while (segments.size() < numberOfSegmentsToRequest) {
+                       final Deadline deadline = 
Deadline.now().plus(Duration.ofMillis(requestSegmentsTimeoutInMillis));
 
 Review comment:
   Let's stick with the `Deadline` as in your proposal there is already a small 
bug (for the timeout based on subtraction to work, you would have to subtract 
it only if `segment == null`, otherwise even if get the buffer after only a 1 
millisecond of waiting, you subtract 2 seconds of waiting 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