Skip to content
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

Cannot acquire connection on many "refresh" #455

Open
manodupont opened this issue Jan 30, 2019 · 0 comments
Open

Cannot acquire connection on many "refresh" #455

manodupont opened this issue Jan 30, 2019 · 0 comments

Comments

@manodupont
Copy link

manodupont commented Jan 30, 2019

When i try to refresh my application running on sbt, it seems like the connection pool is not releasing connections.

Here is the error

[debug] com.zaxxer.hikari.pool.HikariPool - Cannot acquire connection from data source
org.postgresql.util.PSQLException: The connection attempt failed.
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
	at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
	at org.postgresql.Driver.makeConnection(Driver.java:454)
	at org.postgresql.Driver.connect(Driver.java:256)
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:117)
	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:123)
	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:365)
	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:194)
	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:460)
Caused by: java.net.SocketException: Bad file descriptor (Write failed)
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
	at org.postgresql.core.PGStream.flush(PGStream.java:527)
	at org.postgresql.core.v3.ConnectionFactoryImpl.sendStartupPacket(ConnectionFactoryImpl.java:480)
	at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:138)
	at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
	at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)

The config we use is this :

  profile = "utils.MyPostgresProfile$"
  db {
    url = "jdbc:postgresql://localhost:5432/<dbname>?currentSchema=app&loggerLevel=TRACE&loggerFile=./log_pgsql.log&connectTimeout=3&socketTimeout=5&tcpKeepAlive=true&sslmode=disable&ssl=false&"
    properties.driver = "org.postgresql.Driver"
    user = <myuser>
    password = <mypassword>
    poolName = <mypoolname>
    registerMbeans = false
    connectionTimeout = 10s
    connectionInitSql = "SELECT 1"
    connectionTestQuery = "SELECT 1"
    validationTimeout = 5000
    idleTimeout = 300000
    maxLifetime = 50000
    minimumIdle = 10
    leakDetectionThreshold=2000
    maximumPoolSize = 25
    initializationFailTimeout = 0
  }
}

which is then taken under by Hikari and it looks like this

[warn] com.zaxxer.hikari.HikariConfig - The initializationFailFast propery is deprecated, see initializationFailTimeout
[warn] com.zaxxer.hikari.HikariConfig - app - idleTimeout is close to or more than maxLifetime, disabling it.
[debug] com.zaxxer.hikari.HikariConfig - app - configuration:
[debug] com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
[debug] com.zaxxer.hikari.HikariConfig - autoCommit......................true
[debug] com.zaxxer.hikari.HikariConfig - catalog.........................none
[debug] com.zaxxer.hikari.HikariConfig - connectionInitSql..............."SELECT 1"
[debug] com.zaxxer.hikari.HikariConfig - connectionTestQuery............."SELECT 1"
[debug] com.zaxxer.hikari.HikariConfig - connectionTimeout...............10000
[debug] com.zaxxer.hikari.HikariConfig - dataSource......................none
[debug] com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
[debug] com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
[debug] com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>, driver=org.postgresql.Driver}
[debug] com.zaxxer.hikari.HikariConfig - driverClassName.................none
[debug] com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
[debug] com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
[debug] com.zaxxer.hikari.HikariConfig - idleTimeout.....................0
[debug] com.zaxxer.hikari.HikariConfig - initializationFailFast..........false
[debug] com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......-1
[debug] com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
[debug] com.zaxxer.hikari.HikariConfig - jdbc4ConnectionTest.............false
[debug] com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:postgresql://localhost:5432/<mydbname>?currentSchema=app&loggerLevel=TRACE&loggerFile=./log_pgsql.log&connectTimeout=3&socketTimeout=5&tcpKeepAlive=true&sslmode=disable&ssl=false&
[debug] com.zaxxer.hikari.HikariConfig - leakDetectionThreshold..........2000
[debug] com.zaxxer.hikari.HikariConfig - maxLifetime.....................50000
[debug] com.zaxxer.hikari.HikariConfig - maximumPoolSize.................100
[debug] com.zaxxer.hikari.HikariConfig - metricRegistry..................none
[debug] com.zaxxer.hikari.HikariConfig - metricsTrackerFactory...........none
[debug] com.zaxxer.hikari.HikariConfig - minimumIdle.....................20
[debug] com.zaxxer.hikari.HikariConfig - password........................<masked>
[debug] com.zaxxer.hikari.HikariConfig - poolName........................<mypoolname>
[debug] com.zaxxer.hikari.HikariConfig - readOnly........................false
[debug] com.zaxxer.hikari.HikariConfig - registerMbeans..................false
[debug] com.zaxxer.hikari.HikariConfig - scheduledExecutor...............none
[debug] com.zaxxer.hikari.HikariConfig - scheduledExecutorService........internal
[debug] com.zaxxer.hikari.HikariConfig - schema..........................none
[debug] com.zaxxer.hikari.HikariConfig - threadFactory...................internal
[debug] com.zaxxer.hikari.HikariConfig - transactionIsolation............default
[debug] com.zaxxer.hikari.HikariConfig - username........................<myuser>
[debug] com.zaxxer.hikari.HikariConfig - validationTimeout...............5000

And its always, always happening after 5 refresh. No matter what I set in maxConnections, numThreads, etc etc etc.

Any idea ?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants