This is an automated email from the ASF dual-hosted git repository.
MartijnVisser pushed a commit to branch release-2.3
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/release-2.3 by this push:
new c7368b52bcf [FLINK-40675][sql-gateway] Fix unstable
SqlGatewayServiceITCase#testReleaseLockWhenFailedToSubmitOperation
c7368b52bcf is described below
commit c7368b52bcf52e512665e167d664f90c86bc156c
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.");
}