-
Notifications
You must be signed in to change notification settings - Fork 565
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Helidon DBClient does not trigger an Exception when no sane DB connection can be obtained , post application initialization #4719
Comments
Update from customer: |
Hi Helidon Experts, Thanks for clarification on impact. We would like to have this fix/patch in Helidon 2.5.1/2.52. Is there an ETA on this story? Currently we are blocking our story until a fix/workaround is provided, does this sound reasonable? |
namedDml api as well has the same issue . It does not seem to throw a DBClientException if a query (in our case it was create table) is executed when the DB server is unavailable . |
Tested similar scenario with my old Pokemon example.
But example insert code
hangs as described in the bug. |
Looks like one |
@msteffi PR #4772 should fix this for 2.x. You can verify it using https://github.com/Tomas-Kraus/helidon/tree/issue-4719-2.x branch build if you would like to. |
…on when no sane DB connection can be obtained Signed-off-by: Tomas Kraus <[email protected]>
… sane DB connection can be obtained (#4773) Signed-off-by: Tomas Kraus <[email protected]> Signed-off-by: Tomas Kraus <[email protected]>
…n when no sane DB connection can be obtained Signed-off-by: Tomas Kraus <[email protected]>
…sane DB connection can be obtained (#4771) Signed-off-by: Tomas Kraus <[email protected]>
…on when no sane DB connection can be obtained Signed-off-by: Tomas Kraus <[email protected]>
… sane DB connection can be obtained (#4772) Signed-off-by: Tomas Kraus <[email protected]> Signed-off-by: Tomas Kraus <[email protected]>
In case the database server was up during the application initialization and for some reason the server went down ,and then when the application tries to insert a row , we expect a DBClientException to be thrown after the connection timeout , which does not seem to happen .
Environment Details
Problem Description
We are using DBClient in our Helidon SE project with the below configurations
url: jdbc:mysql://127.0.0.1:3306/dbName?failOverReadOnly=false&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: passwd
poolName: mysql
initializationFailTimeout: -1
connectionTimeout: 2000
So if the MySql server is up and running , we see no issues as such . But in case the database server was up during the application initialization and for some reason the server went down ,and then when the application tries to insert a row , we expect a DBClientException to be thrown after the connection timeout of 2000 ms , which does not seem to happen .
Snippet of the thread dump of the helidon application
"helidon-jdbc-dbclient-thread-pool-5" #23 daemon prio=5 os_prio=0 cpu=0.74ms elapsed=1453.67s tid=0x00007f90ecd635b0 nid=0x32c2 waiting on condition [0x00007f90b58f7000]
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x00000007198b57c0> (a java.util.concurrent.SynchronousQueue$TransferQueue)
at java.util.concurrent.locks.LockSupport.parkNanos([email protected]/LockSupport.java:252)
at java.util.concurrent.SynchronousQueue$TransferQueue.transfer([email protected]/SynchronousQueue.java:704)
at java.util.concurrent.SynchronousQueue.poll([email protected]/SynchronousQueue.java:903)
at com.zaxxer.hikari.util.ConcurrentBag.borrow(ConcurrentBag.java:151)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:164)
at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146)
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:100)
at io.helidon.dbclient.jdbc.HikariConnectionPool.connection(HikariConnectionPool.java:53)
at io.helidon.dbclient.jdbc.JdbcDbClient$JdbcExecute$$Lambda$647/0x0000000800e9f790.get(Unknown Source)
7:48
"mysql connection adder" #59 daemon prio=5 os_prio=0 cpu=639.77ms elapsed=1127.21s tid=0x0000556c94ef3f50 nid=0x3f02 waiting on condition [0x00007f908b4fb000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep([email protected]/Native Method)
at com.zaxxer.hikari.util.UtilityElf.quietlySleep(UtilityElf.java:53)
at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:745)
at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:712)
at java.util.concurrent.FutureTask.run([email protected]/FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1136)
at java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:635)
at java.lang.Thread.run([email protected]/Thread.java:833)
Steps to reproduce
[//]: 1 Database server must be up and running when the application starts . Bring down or make the db server non-reachable .
[//]: 2 Make your helidon application to do some operation on the table (insert) and then you will observe that the operation "execute" just hangs .
dbClient
.execute(
exec ->
exec.createNamedInsert("insert")
.indexedParam(entity )
.execute())
.thenApply(e -> entity )
.exceptionally(throwable -> {
logger.atWarning().log( "Failed to insert : %s", throwable);
return null;
});
The text was updated successfully, but these errors were encountered: