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_r302107756
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/buffer/NetworkBufferPool.java
 ##########
 @@ -186,6 +203,22 @@ public void recycle(MemorySegment segment) {
                                if (segment != null) {
                                        segments.add(segment);
                                }
+
+                               if (segments.size() >= 
numberOfSegmentsToRequest) {
+                                       break;
+                               }
+
+                               if (!deadline.hasTimeLeft()) {
+                                       throw new 
IOException(String.format("Insufficient number of network buffers: " +
 
 Review comment:
   This exception throwing looks duplicated. If the message is indeed identical 
everywhere, can you extract it to `throwInsufficientNumberOfNetworkBuffers()` 
method?
   
   or maybe we extract the construction of the 
   > The total number of network buffers is currently set to %d of %d bytes 
each. You can increase this number by setting the configuration keys '%s', 
'%s', and '%s'."
   
   message to a common method, and here throw a slightly modified exception 
with a mention that "timeout was triggered, and you also might want to increase 
the timeout value"?

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