Pool stats total=3 but only one active connection?

478 views
Skip to first unread message

Tobias Galéus

unread,
Jun 26, 2018, 3:09:11 AM6/26/18
to HikariCP
Am I doing something wrong here? Hikari's logfile shows:

08:05:40.630 [HikariPool-1 housekeeper] HikariPool-1 - Pool stats (total=3, active=0, idle=3, waiting=0)

But the mysql db it connects to only shows one active connection:

mysql> show processlist;
+------+------------+-----------------+------------+---------+------+-------+------------------+
| Id   | User       | Host            | db         | Command | Time | State | Info             |
+------+------------+-----------------+------------+---------+------+-------+------------------+
|  927 | nameremoved | localhost:35702 | dbremoved | Sleep   |    1 |       | NULL             |
| 4083 | root       | localhost       | NULL       | Query   |    0 | init  | show processlist |
+------+------------+-----------------+------------+---------+------+-------+------------------+

When Hikari is started it connects with 3 connections to mysql, but it seems to be losing them after some time. But even if they disappear (for whatever reason), shouldn't the total in Pool Stats in the logfile show the actual number of connections?

Best regards,
Tobias

Brett Wooldridge

unread,
Jul 1, 2018, 3:36:06 AM7/1/18
to HikariCP
If the DB is closing connections, HikariCP won’t know until it tries to validate it (upon borrow). It is better to determine how long the DB keeps connections before retirement and set the maxLifetime appropriately.

Tobias Galéus

unread,
Jul 2, 2018, 4:10:18 AM7/2/18
to hika...@googlegroups.com
I think I've done that:

mysql> show session variables where Variable_name = 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+


    <bean id="shibboleth.JPAStorageService.DataSource"
    class="com.zaxxer.hikari.HikariDataSource" destroy-method="close" lazy-init="true"
    p:driverClassName="com.mysql.jdbc.Driver"
    p:username="nameremoved"
    p:password="secret"
    p:autoCommit="false"
    p:transactionIsolation="8"
    p:leakDetectionThreshold="300000"
    p:maximumPoolSize="4"
    p:maxLifetime="28000000"
    />

The leak detection is reporting a leak after just 5 minutes (Full stack trace here: https://pastebin.com/LTx9x2X2 ), but I doubt it's a bug in Shibboleth since more users would have this problem if it was.

Am I doing something wrong?


On Sun, Jul 1, 2018 at 9:36 AM Brett Wooldridge <brett.wo...@gmail.com> wrote:
If the DB is closing connections, HikariCP won’t know until it tries to validate it (upon borrow).  It is better to determine how long the DB keeps connections before retirement and set the maxLifetime appropriately.

--
You received this message because you are subscribed to a topic in the Google Groups "HikariCP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hikari-cp/1hfCqB0wRlE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hikari-cp+...@googlegroups.com.
Visit this group at https://groups.google.com/group/hikari-cp.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages