Open murphyj opened 7 years ago
Whose messages are those? "dbKeepAlive"? "Shuttting down connection pool"? Those aren't HikariCP messages.
Hi @brettwooldridge thanks for responding!
"dbKeepAlive" is TimerTask I've written that hooks into PlayFramework to just poll the database. It still runs the "Shutting down connection pool" line even if that code isn't present. It was my attempt to keep the database connection alive by ensuring a DB connection in the pool was in use every 20 minutes. It didn't work.
"Shutting down connection pool" is probably coming from Play Framework or the slick integration. Although I'm having real trouble figuring out where.
Okay figured out where it's coming from. It's the close method inside HikariCPModule inside the Play Framework itself. I'm using version 2.11-2.5.3
Example snippet:
override def close(dataSource: DataSource) = {
Logger.info("Shutting down connection pool.")
dataSource match {
case ds: HikariDataSource => ds.close()
case _ => sys.error("Unable to close data source: not a HikariDataSource")
}
}
}
@murphyj I suggested a few things on SO, namely enabling DEBUG logging for "com.zaxxer.hikari" may help further diagnose what's wrong with the database setup / application and to try extending the HikariCPModule class or implementing it yourself with extra debug code in the close method which prints the current stack eg.
override def close(dataSource: DataSource) = {
Logger.info("Shutting down connection pool.")
Thread.dumpStack()
dataSource match {
case ds: HikariDataSource => ds.close()
case _ => sys.error("Unable to close data source: not a HikariDataSource")
}
Environment
After running the application for a while I get the following logs informing me that the DB connection pool has been shutdown:
I have tried a number of things, such as, changing the version of the drivers, changing the framework version, tweaking the DB connection configuration and also adding a heartbeat in the code to keep the connections alive.
However, nothing has really helped thus far.
I've posted more details in Stack Overflow with a bounty: http://stackoverflow.com/questions/43824849/play-framework-db-connection-pool-shut-down
Does anyone have any ideas because I'm all out of them?!