You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "ruanwenjun (via GitHub)" <gi...@apache.org> on 2026/06/26 03:13:08 UTC
[PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
ruanwenjun opened a new pull request, #7527:
URL: https://github.com/apache/kyuubi/pull/7527
### Why are the changes needed?
JDBC clients can block inside `KyuubiConnection` construction while waiting for engine launch. If the caller cancels that connection attempt with `Thread.interrupt()`, the wait loop previously kept polling and the caller still had no returned `Connection` object to close.
This patch makes the launch wait path honor interruption by converting it to a typed JDBC exception, `KyuubiInterruptedException`. The interrupt status is intentionally consumed before the exception reaches the caller, and comments explain that the caller receives the typed exception while the current thread is not interrupted.
The patch also keeps `SQLException` subclasses intact when `KyuubiDataSource` creates a connection, so callers can distinguish the interrupted launch path.
### How was this patch tested?
- `./build/mvn -pl kyuubi-hive-jdbc -am spotless:apply`
- `./build/mvn -pl kyuubi-hive-jdbc -am -Dtest=KyuubiConnectionTest,KyuubiStatementTest,TestJdbcDriver,TestKyuubiPreparedStatement,UtilsTest,ZooKeeperHiveClientHelperTest -DwildcardSuites=none test`
- `git diff --check`
Also attempted `dev/reformat`, but the full repo reformat is blocked in this local environment because Spotless expects `black 22.3.0` while the installed executable is `black 25.1.0`.
### Was this patch authored or co-authored using generative AI tooling?
Assisted-by: OpenAI Codex: GPT-5
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 closed pull request #7527: [JDBC] Respect interrupt while waiting for engine launch
URL: https://github.com/apache/kyuubi/pull/7527
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "zhouyifan279 (via GitHub)" <gi...@apache.org>.
zhouyifan279 commented on PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#issuecomment-4844228064
LGTM
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#discussion_r3540813793
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java:
##########
@@ -79,6 +80,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
public static final Logger LOG = LoggerFactory.getLogger(KyuubiConnection.class.getName());
public static final String BEELINE_MODE_PROPERTY = "BEELINE_MODE";
public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
+ private static final String SQL_STATE_LAUNCH_ENGINE_CANCELED = "01000";
Review Comment:
The SQLSTATE "01000" is used for engine launch cancellation, but class "01" is "success-with-warning." Any caller distinguishing errors from warnings via `getSQLState()` will misclassify it. Recommend "57014" (query cancelled) or "HY008" (operation cancelled).
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "wangzhigang1999 (via GitHub)" <gi...@apache.org>.
wangzhigang1999 commented on PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#issuecomment-4844694968
LGTM 👍
Just a nit (non-blocking): isInterrupted(Throwable) and the test's hasCause(...) both hand-roll a cause-chain walk. Since commons-lang3 is already a dependency here (this file already imports StringUtils/ClassUtils from it), we could reuse ExceptionUtils and drop both helpers:
```java
// import org.apache.commons.lang3.exception.ExceptionUtils;
ExceptionUtils.indexOfType(e, InterruptedException.class) >= 0
```
Same semantics, ~20 fewer lines, removes the duplicated logic between main and test.
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#issuecomment-4932990640
thanks, merged to master
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#issuecomment-4861796423
Addressed in 6795917ac: replaced both cause-chain walks with `ExceptionUtils.indexOfType(..., InterruptedException.class)` and removed the duplicated helpers.
Verified with:
- `./build/mvn -pl kyuubi-hive-jdbc -am spotless:apply`
- `./build/mvn -pl kyuubi-hive-jdbc -am -Dtest=KyuubiConnectionTest,KyuubiStatementTest,TestJdbcDriver,TestKyuubiPreparedStatement,UtilsTest,ZooKeeperHiveClientHelperTest -DwildcardSuites=none test`
- `git diff --check`
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#discussion_r3540936291
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java:
##########
@@ -79,6 +80,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
public static final Logger LOG = LoggerFactory.getLogger(KyuubiConnection.class.getName());
public static final String BEELINE_MODE_PROPERTY = "BEELINE_MODE";
public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
+ private static final String SQL_STATE_LAUNCH_ENGINE_CANCELED = "01000";
Review Comment:
Addressed in 6ff3e96ef. Changed launch-engine cancellation from warning-class `01000` to error-class `57014`, and added a regression test for `CANCELED_STATE` in `waitLaunchEngineToComplete`.
Verified with:
- `./build/mvn -pl kyuubi-hive-jdbc -am spotless:apply`
- `./build/mvn -pl kyuubi-hive-jdbc -am -Dtest=KyuubiConnectionTest,KyuubiStatementTest,TestJdbcDriver,TestKyuubiPreparedStatement,UtilsTest,ZooKeeperHiveClientHelperTest -DwildcardSuites=none test`
- `git diff --check`
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#discussion_r3540987474
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java:
##########
@@ -79,6 +80,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
public static final Logger LOG = LoggerFactory.getLogger(KyuubiConnection.class.getName());
public static final String BEELINE_MODE_PROPERTY = "BEELINE_MODE";
public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
+ private static final String SQL_STATE_LAUNCH_ENGINE_CANCELED = "01000";
Review Comment:
Thanks, done, changed to `57014 `.
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#issuecomment-4806224079
PTAL cc @pan3793 @cxzl25
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org
Re: [PR] [JDBC] Respect interrupt while waiting for engine launch [kyuubi]
Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #7527:
URL: https://github.com/apache/kyuubi/pull/7527#discussion_r3540987474
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java:
##########
@@ -79,6 +80,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
public static final Logger LOG = LoggerFactory.getLogger(KyuubiConnection.class.getName());
public static final String BEELINE_MODE_PROPERTY = "BEELINE_MODE";
public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
+ private static final String SQL_STATE_LAUNCH_ENGINE_CANCELED = "01000";
Review Comment:
Thanks, done, changed to `57014 `.
##########
kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/KyuubiConnection.java:
##########
@@ -79,6 +80,7 @@ public class KyuubiConnection implements SQLConnection, KyuubiLoggable {
public static final Logger LOG = LoggerFactory.getLogger(KyuubiConnection.class.getName());
public static final String BEELINE_MODE_PROPERTY = "BEELINE_MODE";
public static final String HS2_PROXY_USER = "hive.server2.proxy.user";
+ private static final String SQL_STATE_LAUNCH_ENGINE_CANCELED = "01000";
Review Comment:
Addressed in 6ff3e96ef. Changed launch-engine cancellation from warning-class `01000` to error-class `57014`, and added a regression test for `CANCELED_STATE` in `waitLaunchEngineToComplete`.
--
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: notifications-unsubscribe@kyuubi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org