This is an automated email from the ASF dual-hosted git repository.

MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 0abe56351c0 [FLINK-40675][sql-gateway] Fix unstable 
SqlGatewayServiceITCase#testReleaseLockWhenFailedToSubmitOperation
0abe56351c0 is described below

commit 0abe56351c0248bb8ac6c717386d89de2bde7e25
Author: SEPURI-SAI-KRISHNA <[email protected]>
AuthorDate: Tue Sep 15 21:02:46 2026 +0530

    [FLINK-40675][sql-gateway] Fix unstable 
SqlGatewayServiceITCase#testReleaseLockWhenFailedToSubmitOperation
    
    Generated-by: Claude Code (Opus 5)
---
 .../gateway/service/SqlGatewayServiceITCase.java   | 28 +++++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git 
a/flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java
 
b/flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java
index d64ed8f35f8..a5c434d1892 100644
--- 
a/flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java
+++ 
b/flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/service/SqlGatewayServiceITCase.java
@@ -68,6 +68,7 @@ import org.apache.flink.test.junit5.MiniClusterExtension;
 import org.apache.flink.test.util.TestUtils;
 import org.apache.flink.testutils.executor.TestExecutorExtension;
 import org.apache.flink.util.CollectionUtil;
+import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.UserClassLoaderJarTestUtils;
 import org.apache.flink.util.concurrent.ExecutorThreadFactory;
 import org.apache.flink.util.function.RunnableWithException;
@@ -957,14 +958,29 @@ public class SqlGatewayServiceITCase {
         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),
+                "The pool never freed a thread to accept the operation.");
         CommonTestUtils.waitUtil(
                 () -> success.getCount() == 0, Duration.ofSeconds(10), "Should 
come to end.");
     }

Reply via email to