MartijnVisser commented on code in PR #29194:
URL: https://github.com/apache/flink/pull/29194#discussion_r4018367403


##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java:
##########
@@ -957,14 +958,29 @@ void testReleaseLockWhenFailedToSubmitOperation() throws 
Exception {
         latch.countDown();
         // Wait the first operation finishes
         awaitOperationTermination(service, sessions.get(0), operations.get(0));
-        // Service is able to submit operation
+        // Service is able to submit operation. The first operation turns 
terminal before its
+        // thread is back in the pool, so retry until a thread is free.
         CountDownLatch success = new CountDownLatch(1);
-        service.submitOperation(
-                sessionHandle,
+        CommonTestUtils.waitUtil(
                 () -> {
-                    success.countDown();
-                    return getDefaultResultSet();
-                });
+                    try {
+                        service.submitOperation(
+                                sessionHandle,
+                                () -> {
+                                    success.countDown();
+                                    return getDefaultResultSet();
+                                });
+                        return true;
+                    } catch (SqlGatewayException e) {
+                        if (ExceptionUtils.findThrowable(e, 
RejectedExecutionException.class)
+                                .isPresent()) {
+                            return false;
+                        }
+                        throw e;
+                    }
+                },
+                Duration.ofSeconds(10),
+                "Failed to submit the operation after the pool had a free 
thread.");

Review Comment:
   This message says the opposite of what a timeout here means. If it fires, 
the pool never freed a thread.



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