zentol commented on code in PR #20157:
URL: https://github.com/apache/flink/pull/20157#discussion_r914777339


##########
flink-runtime/src/test/java/org/apache/flink/runtime/io/network/partition/ResultPartitionTest.java:
##########
@@ -405,20 +395,37 @@ public void testIdleAndBackPressuredTime() throws 
IOException, InterruptedExcept
         // wait until request thread start to run.
         syncLock.await();
 
-        Thread.sleep(100);
+        // wait until request buffer blocking.
+        boolean bufferPoolBlocking = false;
+
+        for (int i = 0; i < 50; i++) {
+            StackTraceElement[] stackTrace = requestThread.getStackTrace();
+            bufferPoolBlocking = isInBlockingBufferRequest(stackTrace);
+
+            if (bufferPoolBlocking) {
+                break;
+            } else {
+                // Retry
+                Thread.sleep(500);
+            }
+        }
+
+        // Verify that Thread was in blocking request
+        assertThat(bufferPoolBlocking)
+                .isTrue()
+                .withFailMessage("Did not trigger blocking buffer request.");

Review Comment:
   ```suggestion
           while (!isInBlockingBufferRequest(requestThread.getStackTrace()) {
                   Thread.sleep(50);
            }
   ```



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to