2

I've just started using HikariCP in a swing application with hibernate. I'm maintaining and old project, so there are a lot of crazy stuff going on in there. The connection leak detection feature helped me understand the sessions would close only on certain events, for example when a user is clicking on the "Save" button. In other cases, there is a leak. I'm thinking the previous developers were trying to implement the "long conversations" unit of work, but they missed some (most) cases.

So my goal now is to find all leaks and fix them. I'm planning to use the HikariCP debug output to help me do that. I don't know if there is a wiki page on the HikariCP documentation that explains the output of debugging, but I was wondering if this output when the application is idle is normal, or there is something strange going in there that I should investigate more:

2015-09-14 01:12:51 DEBUG HikariPool - After fill pool stats HikariPool-0 (total=10, inUse=3, avail=7, waiting=0)
2015-09-14 01:13:21 DEBUG HikariPool - Before cleanup pool stats HikariPool-0 (total=10, inUse=3, avail=7, waiting=0)
2015-09-14 01:13:21 DEBUG HikariPool - After cleanup pool stats HikariPool-0 (total=6, inUse=3, avail=3, waiting=0)
2015-09-14 01:13:21 DEBUG PoolUtilities - Closing connection com.mysql.jdbc.JDBC4Connection@4fb38272
2015-09-14 01:13:21 DEBUG PoolUtilities - Closing connection com.mysql.jdbc.JDBC4Connection@417465f4
2015-09-14 01:13:21 DEBUG PoolUtilities - Closing connection com.mysql.jdbc.JDBC4Connection@454be902
2015-09-14 01:13:21 DEBUG PoolUtilities - Closing connection com.mysql.jdbc.JDBC4Connection@496fcf

If this is normal behaviour, I would also like to know what these 4 connections are for, and why are they closing at that point. Thanks.

George Sofianos
  • 440
  • 1
  • 7
  • 17

1 Answers1

2

This is all normal output. These connections are likely closing due to being idle for the "idleTimeout" period, or because they reached their lifetime ("maxLifetime"). I do recommend updating to the latest version (2.4.x), which will typically provide a reason why the connection was closed in the debug log message.

brettw
  • 10,664
  • 2
  • 42
  • 59
  • Thanks for responding. What I can't understand is why the total connection number is 10 then suddenly 6, then that 4 "missing" connections seem to be closing. I guess it's just the way it works. This output was from 2.4.1 version. – George Sofianos Sep 20 '15 at 22:36
  • 1
    It doesn't appear to be v2.4.1. The *PoolUtilties* class no longer exists. The message should be something like "PoolElf - Closing connection com.mysql.jdbc.JDBC4Connection@4fb38272: (connection passed idleTimeout)". Where "(connection passed idleTimeout)" could be one of several messages, including "(connection evicted or dead)" or "(connection reached maxLifetime)". – brettw Sep 21 '15 at 07:33
  • It seems the hibernate version I was using (4.3.11 final - released Aug 2015) has a dependency of an older version of HikariCP (2.3.3). I will try to upgrade hibernate then first. – George Sofianos Sep 21 '15 at 21:31