Hikaricp: Failed to get/set network timeout for connection.

Created on 5 Mar 2016  ·  47Comments  ·  Source: brettwooldridge/HikariCP

Using latest (9.4.1208) PostgreSQL JDBC driver and Java 8:

WARN 15:55:44,723 lBase - HikariPool-0 - Failed to get/set network timeout for connection. (Method org.postgresql.jdbc.PgConnection.getNetworkTimeout() is not yet implemented.)

Is it falling back to a safe value if such call fails? Maybe modifying that message to state something like:

_Falling back to X value or using X default value instead._

Would be great not to panic the user?

Most helpful comment

@guidomedina @jerori @brunoliveiralcantara @tiaobug @hadirsa @wuwen5 I finally got tired of PostgreSQL users running into this issue and coming to HikariCP for support, so I have submitted a pull request to implement get/setNetworkTimeout() in the pgjdbc driver (pgjdbc/pgjdbc#849). Just thought that you might want to know.

All 47 comments

@guidomedina This message should be logged at info. level rather than warn. There is no fallback. This message means that the driver does not support setNetworkTimeout(), which means that HikariCP cannot protect against network partitions.

HikariCP 2.4.5 was been released with a fix for this issue.

Yeap, just noticed and updated, thanks for the hark work @brettwooldridge

Folks this issue continue.. even with 2.4.6
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented.

Any clue?

I migrated one big application today to HikariCP with PostgreSQL 9.4 with JDBC driver version 9.4.1208 (Java 8 version) and I don't have this issue, using HikariCP 2.4.6

It's strange, everything looks is working fine except the issue:

2016-06-21 00:17:29,239 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:839] HikariPool-1 - configuration:
2016-06-21 00:17:29,244 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] allowPoolSuspension.............false
2016-06-21 00:17:29,245 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] autoCommit......................true
2016-06-21 00:17:29,245 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] catalog.........................null
2016-06-21 00:17:29,246 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] connectionInitSql...............null
2016-06-21 00:17:29,247 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] connectionTestQuery............."SELECT 1"
2016-06-21 00:17:29,248 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] connectionTimeout...............30000
2016-06-21 00:17:29,249 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] dataSource......................null
2016-06-21 00:17:29,256 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] dataSourceClassName.............null
2016-06-21 00:17:29,258 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] dataSourceJNDI..................null
2016-06-21 00:17:29,259 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] dataSourceProperties............{password=}
2016-06-21 00:17:29,260 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855]
driverClassName................."org.postgresql.Driver"
2016-06-21 00:17:29,260 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] healthCheckProperties...........{}
2016-06-21 00:17:29,261 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] healthCheckRegistry.............null
2016-06-21 00:17:29,262 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] idleTimeout.....................600000
2016-06-21 00:17:29,263 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] initializationFailFast..........true
2016-06-21 00:17:29,265 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] isolateInternalQueries..........false
2016-06-21 00:17:29,266 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] jdbc4ConnectionTest.............false
2016-06-21 00:17:29,266 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855]
jdbcUrl........................."jdbc:postgresql://localhost:5432/mydb"
2016-06-21 00:17:29,268 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] leakDetectionThreshold..........0
2016-06-21 00:17:29,269 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] maxLifetime.....................1800000
2016-06-21 00:17:29,270 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] maximumPoolSize.................20
2016-06-21 00:17:29,271 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] metricRegistry..................null
2016-06-21 00:17:29,272 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] metricsTrackerFactory...........null
2016-06-21 00:17:29,272 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] minimumIdle.....................20
2016-06-21 00:17:29,277 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] password........................
2016-06-21 00:17:29,278 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] poolName........................"HikariPool-1"
2016-06-21 00:17:29,279 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] readOnly........................false
2016-06-21 00:17:29,280 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] registerMbeans..................false
2016-06-21 00:17:29,281 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] scheduledExecutorService........null
2016-06-21 00:17:29,282 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] threadFactory...................null
2016-06-21 00:17:29,283 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] transactionIsolation............null
2016-06-21 00:17:29,283 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] username........................"uid"
2016-06-21 00:17:29,284 DEBUG [localhost-startStop-1] c.z.h.HikariConfig
[HikariConfig.java:855] validationTimeout...............5000
2016-06-21 00:17:29,286 INFO [localhost-startStop-1] c.z.h.HikariDataSource
[HikariDataSource.java:70] HikariPool-1 - Started.
2016-06-21 00:17:29,485 INFO [localhost-startStop-1] c.z.h.p.PoolBase
[PoolBase.java:444] HikariPool-1 - Driver does not support get/set network
timeout for connections. (Method
org.postgresql.jdbc4.Jdbc4Connection.getNetworkTimeout() is not yet
implemented.)

A question for you, did you implement the Hikari datasource? or is it being
pull it though boo-autoconfigure?
Thanks -JR

On Fri, Jun 17, 2016 at 5:33 PM, Guido Medina [email protected]
wrote:

I migrated one big application today to HikariCP with PostgreSQL 9.4 with
JDBC driver version 9.4.1208 (Java 8 version) and I didn't get this issue,
with 2.4.6


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/brettwooldridge/HikariCP/issues/593#issuecomment-226886865,
or mute the thread
https://github.com/notifications/unsubscribe/AJ2MKWeiRu0CiqOrkMT0PHc18sFK6woQks5qMxKqgaJpZM4HqBo9
.

Any solution for this log? Still continues with this message:

INFO com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Driver does not support get/set network timeout for connections. (Method org.postgresql.jdbc.PgConnection.getNetworkTimeout() is not yet implemented.)

I am using version 5.2.4.Final of hibernate-hikaricp:

<dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-hikaricp</artifactId>
        <version>5.2.4.Final</version>
</dependency>

I already tested with latest version 2.5.1 HikariCP too:

<dependency>
        <groupId>com.zaxxer</groupId>
        <artifactId>HikariCP</artifactId>
        <version>2.5.1</version>
</dependency>

i also got this issue now.
i use version 2.5.1.

`13:49:54.880 INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Started.

13:49:54.992 INFO com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Driver does not support get/set network timeout for connections.( Method org.postgresql.jdbc.PgConnection.getNetworkTimeout() is not yet implemented.)`

@tiaobug Look at brettwooldridge's previous reply and this modify {https://github.com/brettwooldridge/HikariCP/commit/bd96f1cca4a2f7169fa36984e579bd18653e70a6} , so I think it's just a info log.

This message should be logged at info. level rather than warn. There is no fallback. This message means that the driver does not support setNetworkTimeout(), which means that HikariCP cannot protect against network partitions.

That is correct. Please open a bug against the PostgreSQL JDBC project. They are putting their users at risk, because without network timeouts a network interruption can cause the pool to hang for up to the OS TCP timeout -- typically several hours for both Linux and Windows.

After seeing so many problems in drivers, I wish that @brettwooldridge implement these drivers for us 👼

Most of these issues are extremely simple to fix or implement -- often only an hour or two. All of these projects need volunteers, so pick an annoying issue, fix it, and submit a patch.

Hi, i have the save problem, i have a question, which Postgres driver version you are using? i use blow as maven dependency:

 <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>9.3-1100-jdbc41</version>
 </dependency>`

but get message below building project:
HikariPool-1 - Started. 2017-02-28 15:05:12.543 INFO 2960 --- [ost-startStop-1] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (Method org.postgresql.jdbc.PgConnection.getNetworkTimeout() is not yet implemented.)

@hadirsa For PostgreSQL you might investigate pgjdbc-ng.

Am I missing something?
Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
Thanks

@Photon156 What version of Connector/J are you using? Newer versions should support the network timeout API, as far as I know.

HikariCP version 2.6, latest I think.

>

What version of Connector/J are you using?

It's that connector/J version that matters for that issue.

On Mon, Mar 6, 2017 at 8:04 PM, Photon156 notifications@github.com wrote:

HikariCP version 2.6, latest I think.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/brettwooldridge/HikariCP/issues/593#issuecomment-284587148,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE9tUtGbe-1sYiP1vAU04qIDWpwuzXFFks5rjK0VgaJpZM4HqBo9
.

Version 5.1.14

That version was released on May 08, 2015. I'm not sure if it supports that
API or not but you might want to look into upgrading either way.
https://mvnrepository.com/artifact/mysql/mysql-connector-java

On Mon, Mar 6, 2017 at 8:35 PM, Photon156 notifications@github.com wrote:

Version 5.1.14


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/brettwooldridge/HikariCP/issues/593#issuecomment-284592701,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AE9tUiIprdx2_ZDEjTUDBsivs2G1Na8Yks5rjLRKgaJpZM4HqBo9
.

@brettwooldridge thanks for attention.

now i have error using pgjdbc-ng :

             Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: null
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
    ... 50 more
Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: null
    at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:536)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:528)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:113)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:97)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:326)
    at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:366)
    at org.springframework.boot.autoconfigure.orm.jpa.DatabaseLookup.getDatabase(DatabaseLookup.java:72)
    at org.springframework.boot.autoconfigure.orm.jpa.JpaProperties.determineDatabase(JpaProperties.java:139)
    at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.jpaVendorAdapter(JpaBaseConfiguration.java:105)
    at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$f0676db3.CGLIB$jpaVendorAdapter$3(<generated>)
    at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$f0676db3$$FastClassBySpringCGLIB$$b0c8ba08.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
    at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration$$EnhancerBySpringCGLIB$$f0676db3.jpaVendorAdapter(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 51 more
Caused by: java.lang.NullPointerException
    at com.impossibl.postgres.system.BasicContext.loadLocale(BasicContext.java:294)
    at com.impossibl.postgres.system.BasicContext.init(BasicContext.java:273)
    at com.impossibl.postgres.jdbc.PGConnectionImpl.init(PGConnectionImpl.java:251)
    at com.impossibl.postgres.jdbc.ConnectionUtil.createConnection(ConnectionUtil.java:182)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:77)
    at com.impossibl.postgres.jdbc.PGDriver.connect(PGDriver.java:52)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95)
    at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:101)
    at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:346)
    at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:196)
    at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:442)
    at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:505)
    ... 70 more

Application.yml:

jpa: 
        database-platform: org.hibernate.dialect.PostgreSQLDialect 
        hibernate:
            connection.release_mode: after_statement 
.

.
.
.
datasource:
        type: com.zaxxer.hikari.HikariDataSource
        hikari:
            data-source-properties:
                cachePrepStmts: true
                prepStmtCacheSize: 250
                prepStmtCacheSqlLimit: 2048
                useServerPrepStmts: true
                minimum-idle: 1
                maximum-pool-size: 50
                pool-name: vpool
                maxLifetime:  20000
                idleTimeout:  60000 
                connectionTimeout:  60000 
                validationTimeout: 50000 

        driver-class-name: com.impossibl.postgres.jdbc.PGDriver
        url: jdbc:pgsql://localhost:5432/cm2 
        username: postgres
        password: postgres
        internal_logon: normal
        validationQuery : SELECT 1
        test-on-borrow : true

pom.xml

        <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.impossibl.pgjdbc-ng</groupId>
        <artifactId>pgjdbc-ng</artifactId>
        <version>0.7</version>
        <classifier>complete</classifier>
    </dependency>
    <dependency>
        <groupId>com.zaxxer</groupId>
        <artifactId>HikariCP</artifactId>
        <version>2.6.0</version>
    </dependency>

What is the problem or any miss configuration?

There are so many problems with that configuration I don't know where to begin. You've got pool settings in the data-source-properties, you've got MySQL properties in there, I don't know where internal_login or test-on-borrow came from...

Stop wasting our time with stupid questions.

@guidomedina @jerori @brunoliveiralcantara @tiaobug @hadirsa @wuwen5 I finally got tired of PostgreSQL users running into this issue and coming to HikariCP for support, so I have submitted a pull request to implement get/setNetworkTimeout() in the pgjdbc driver (pgjdbc/pgjdbc#849). Just thought that you might want to know.

It's a good news.Thanks for your attention.

With regards

On Jun 24, 2017 8:40 PM, "Brett Wooldridge" notifications@github.com
wrote:

@guidomedina https://github.com/guidomedina @jerori
https://github.com/jerori @brunoliveiralcantara
https://github.com/brunoliveiralcantara @tiaobug
https://github.com/tiaobug @hadirsa https://github.com/hadirsa @wuwen5
https://github.com/wuwen5 I finally got tired of PostgreSQL users
running into this issue and coming to HikariCP for support, so I have
submitted a pull request to implement get/setNetworkTimeout() in the
pgjdbc driver (pgjdbc/pgjdbc#849
https://github.com/pgjdbc/pgjdbc/pull/849). Just thought that you might
want to know.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/brettwooldridge/HikariCP/issues/593#issuecomment-310847793,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADwpxs4QMaxVdlh2Meomeg_Kv1Jw-zloks5sHTTggaJpZM4HqBo9
.

Thank you @brettwooldridge.

@brettwooldridge
We had some flaky network issues and got connection timeout only after 15minutes.

Caused by: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 931191ms.
    at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:606) ~[HikariCP-2.7.1.jar!/:?]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:196) ~[HikariCP-2.7.1.jar!/:?]
    at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146) ~[HikariCP-2.7.1.jar!/:?]
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-2.7.1.jar!/:?]
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111) ~[spring-jdbc-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77) ~[spring-jdbc-4.3.11.RELEASE.jar!/:4.3.11.RELEASE]
    ... 72 more

Would you say that the absence of network timeout support in PG driver is to blame? And that https://github.com/pgjdbc/pgjdbc/pull/849 will most likely fix it?

Actually, this is potentially troubling. Regardless of the underlying database or TCP timeouts, the call to DataSource.getConnection() should honor the connectionTimeout setting. Underlying connection acquisition is asynchronous, and should not affect front-end calls to getConnection().

Can you confirm that the pool is actually not configured with a long connectionTimeout?

Seems to be the standard 30000.

Hmmm. That is very strange. The timeout isn't even near a round number ... 15.51 minutes.

Is there any other warnings/error in the logs? Any logs about "Thread starvation or clock leap detected"?

Can you provide some information about the environment? Standard server/virtual machine/desktop/laptop? Java version, HikariCP version?

I'll dig in the logs on Monday.

AWS EC2 instance
Postgres 9.5.4
Java 8 u14X
PG driver 42.1.4
HikariCP 2.7.1

@mihhail-lapushkin Thanks. I'm scrutinizing the code, but so far I can't find anything that accounts for the error. The only thing that seems possible is that a clock leap occurred, and the elapsed wait time is mis-reported.

When you get a chance on Monday, check that NTP is enabled and running on the box. The Amazon AMI images almost always have it enabled, but other AMIs often don't. Another possiblility that I can think of would be if AWS live-migrated your VM to another host, and somehow the clocks were different. Anyway, it's all speculation until you get a look at the logs.

There are no logs containing "Thread starvation or clock leap detected".
The only WARN logs that HikariPool had printed were about Connection is not available

Hi!
I had a similar problem when connecting kylo to PostgreSQL.
It was reproduced when I used the library postgresql-9.1-901-1.jdbc4.jar as a driver.
After I used the library postgresql-42.1.4.jar (https://jdbc.postgresql.org/download/postgresql-42.1.4.jar), the problem was fixed.
Good luck :)

@mihhail-lapushkin and @brettwooldridge was a final resolution ever determined for this problem? I see there has been some networktimeout code committed against the pgjdbc driver for 42.1.5 release. Was the lack of timeout support determined to be the true cause?

We are sort of battling a similar issue with Hikari, pgpool and jdbc stack that db connections are getting frozen for ~16 minutes if network connectivity gets lost to second node.

Nope. I did not investigate the issue further, as it was rarely occurring and would probably take quite some time to debug.

Turned on debug logging for HikariPool and noticed one pattern. Most of the timeouts print the correct 30000ms. The ones that print those huge numbers like 931101ms (all of them circulate around 15min btw) are always followed by Closing connection (connection is dead) log message.

Please try PostgreSQL JDBC 42.2.x which added this driver functionality, like it has been said at the beginning of this issue, this wasn't a HikariCP issue but a lack of this functionality on the driver:
https://github.com/pgjdbc/pgjdbc/pull/849

Yep, will definitely give it a try. Why I am continuing on this topic is because @brettwooldridge said here that the connection timeout (30000ms) should be honoured no matter the network timeout. Or maybe I got it wrong...

I should clarify my statement. Callers to getConnection() are not blocked by new connection acquisition, even in the case of network disconnection.

However, if an existing connection must be validated, the network is disconnected, and the driver does not support network timeout, then it is possible for the driver to “hang” — blocking the caller as well.

As noted above, there is a new PostgreSQL driver available with support for network timeout.

How can we solve this for Redshift?

My Hikari version is 2.7.8and it's inherited from Spring Boot parent.

I tried to use the lastest Redshift driver

<repository>
    <id>redshift</id>
    <url>https://s3.amazonaws.com/redshift-maven-repository/release</url>
</repository>
<dependency>
    <groupId>com.amazon.redshift</groupId>
    <artifactId>redshift-jdbc42-no-awssdk</artifactId>
    <version>1.2.12.1017</version>
</dependency>

and other variations too.

I have the same issue

Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented



org.hibernate
hibernate-hikaricp
5.3.3.Final

    <!-- https://mvnrepository.com/artifact/postgresql/postgresql -->
    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.1-901-1.jdbc4</version>
    </dependency>

I'm using with Java 10

Not working at all

@raphaelLacerda That is a very old postgresql driver. Support for isValid(), and get/setNetworkTimeout() are available in the latest release.

i got the same problem.

com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I)
compile "io.micronaut.configuration:micronaut-jdbc-hikari" 

i am using micronaut.

//tag::jpa[]
    compile "io.micronaut.configuration:micronaut-hibernate-jpa" // <1>
    compile "io.micronaut.configuration:micronaut-jdbc-hikari" // <2>
//    implementation 'com.zaxxer:HikariCP:3.2.0'
//    runtime "com.h2database:h2" // <3>
    //end::jpa[]

    //tag::mysql-connector[]
    // https://mvnrepository.com/artifact/mysql/mysql-connector-java
    compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.13'
    //end::mysql-connector[]

That must be a pretty old MySQL driver. Please upgrade.

When the database is connected for too long, while when it is released occured this Exception HikariPool-1 – Connection is not available, request timed out after 30001ms, and could not connect again. Has anybody ever met?

Hi I'm facing the same issue and my tomcat gets stopped automatically. Could anyone please give me a solution?

02-01-2019 00:59:05.883 [main] INFO  com.zaxxer.hikari.HikariDataSource.getConnection - HikariPool-2 - Starting...
02-01-2019 00:59:06.952 [main] INFO  com.zaxxer.hikari.pool.PoolBase.getAndSetNetworkTimeout - HikariPool-2 - Driver does not support get/set network timeout for connections. (null)
02-01-2019 00:59:06.987 [main] INFO  com.zaxxer.hikari.HikariDataSource.getConnection - HikariPool-2 - Start completed.
02-01-2019 00:59:07.002 [main] INFO  org.hibernate.dialect.Dialect. - HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
02-01-2019 00:59:08.741 [main] INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-2 - Shutdown initiated...
02-01-2019 00:59:08.925 [main] INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-2 - Shutdown completed.
02-01-2019 00:59:08.925 [main] INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-1 - Shutdown initiated...
02-01-2019 00:59:08.941 [main] INFO  com.zaxxer.hikari.HikariDataSource.close - HikariPool-1 - Shutdown completed.
02-01-2019 00:59:08.941 [main] INFO  o.a.catalina.core.StandardService.log - Stopping service [Tomcat]


org.postgresql
postgresql
42.1.1

after applying this postgresql dependecny issue resolved for me

Was this page helpful?
0 / 5 - 0 ratings