Connections closing prematurely

169 views
Skip to first unread message

Jim Merk

unread,
Nov 1, 2019, 10:47:44 AM11/1/19
to HikariCP

Hi. I have a Java app using Hikari with MySQL using jdbc driver. My maxlifetime value has been set to 1800000 (millis) which is much less than the MySQL wait_timeout of 28800 (seconds). I'm still getting errors (below) when attempting to write data after several hours of idle. Is it correct that if the maxlifetime value is less than MySQL's wait_timeout, the connection is retired AND another created by Hikari to replace it, or do I need to check this and create another connection with java? Also, do I have this backwards and the solution would be to extend both the maxlifetime and wait_timeout to more than 12 hours? I'm fairly new to this. Any help would be greatly appreciated. 


[08:17:38] [Thread-8/WARN]: [com.zaxxer.hikari.pool.ProxyConnection] HikariPool-1 - Connection com.mysql.jdbc.JDBC4Connection@3ed589b4 marked as broken because of SQLSTATE(08003), ErrorCode(0)
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_201]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_201]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_201]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_201]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.Util.getInstance(Util.java:408) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.throwConnectionClosedException(ConnectionImpl.java:1192) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.checkClosed(ConnectionImpl.java:1187) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.versionMeetsMinimum(ConnectionImpl.java:5202) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.DatabaseMetaData$8.forEach(DatabaseMetaData.java:4135) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.DatabaseMetaData$8.forEach(DatabaseMetaData.java:4087) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.IterateBlock.doForAll(IterateBlock.java:50) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.DatabaseMetaData.getProceduresAndOrFunctions(DatabaseMetaData.java:4085) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.DatabaseMetaData.getProcedureOrFunctionColumns(DatabaseMetaData.java:3930) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.JDBC4DatabaseMetaData.getProcedureColumns(JDBC4DatabaseMetaData.java:108) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:779) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:569) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.JDBC4CallableStatement.<init>(JDBC4CallableStatement.java:42) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.JDBC42CallableStatement.<init>(JDBC42CallableStatement.java:35) ~[patched_1.13.2.jar:git-Paper-651]
at sun.reflect.GeneratedConstructorAccessor63.newInstance(Unknown Source) ~[?:?]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_201]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_201]
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.CallableStatement.getInstance(CallableStatement.java:471) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.parseCallableStatement(ConnectionImpl.java:3901) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java:3968) ~[patched_1.13.2.jar:git-Paper-651]
at com.mysql.jdbc.ConnectionImpl.prepareCall(ConnectionImpl.java:3944) ~[patched_1.13.2.jar:git-Paper-651]
at com.zaxxer.hikari.pool.ProxyConnection.prepareCall(ProxyConnection.java:297) ~[?:?]
at com.zaxxer.hikari.pool.HikariProxyConnection.prepareCall(HikariProxyConnection.java) ~[?:?]
at com.my.app.Database.Queue.run(Queue.java:33) ~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_201]


My Queue class if checking for a connection and creating one if necessary.


My config....

[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] HikariPool-1 - configuration:
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] allowPoolSuspension.............false
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] autoCommit......................true
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] catalog.........................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] connectionInitSql...............none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] connectionTestQuery.............none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] connectionTimeout...............30000
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] dataSource......................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] dataSourceClassName............."com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] dataSourceJNDI..................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] dataSourceProperties............{url=jdbc:mysql://xx:xxxx/xxxx, cacheServerConfiguration=true, useServerPrepStmts=true, elideSetAutoCommits=true, user=xxxxx, useSSL=false, cachePrepStmts=true, rewriteBatchedStatements=true, cacheResultSetMetadata=true, useLocalSessionState=true, maintainTimeStats=false, prepStmtCacheSize=250, prepStmtCacheSqlLimit=2048, password=<masked>}
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] driverClassName.................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] healthCheckProperties...........{}
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] healthCheckRegistry.............none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] idleTimeout.....................600000
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] initializationFailTimeout.......1
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] isolateInternalQueries..........false
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] jdbcUrl.........................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] leakDetectionThreshold..........0
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] maxLifetime.....................1800000
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] maximumPoolSize.................4
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] metricRegistry..................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] metricsTrackerFactory...........none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] minimumIdle.....................4
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] password........................<masked>
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] poolName........................"HikariPool-1"
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] readOnly........................false
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] registerMbeans..................false
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] scheduledExecutor...............none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] schema..........................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] threadFactory...................internal
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] transactionIsolation............default
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] username........................none
[09:18:10] [Server thread/DEBUG]: [com.zaxxer.hikari.HikariConfig] validationTimeout...............5000


Reply all
Reply to author
Forward
Message has been deleted
0 new messages