title: Hikaripool : No new connections are added to the pool when old connections are expired
body: <p>I have a Hikari pool for AzureSQL database. The pool size is 75. Initialy it add 75 conncetions to the pool, when connections are closed, its adding new connectiosn to the pool.
  <br>
  Pool configuration is shown below.</p>
  
  <p><br>
  But after some time we see the total number of connections in the pool goes down. When connections are cloased no new connections are added to the pool. Finally the <em>total</em> number of connections reach ZERO.
  <br>
  Please refer the logs below. The logs clearly shows this behaviour.
  <br>
  Once total connection is ZERO, threads wait for connection and finally times out with error <em>Connection is not available, request timed out after 30000ms</em></p>
  
  <p>Below is the connection pool configuration.</p>
  
  <pre><code>MyConnectionPool - configuration:
  allowPoolSuspension.............false
  autoCommit......................true
  catalog.........................none
  connectionInitSql...............none
  connectionTestQuery.............none
  connectionTimeout...............30000
  dataSource......................none
  dataSourceClassName.............none
  dataSourceJNDI..................none
  dataSourceProperties............{password=&lt;masked&gt;}
  driverClassName................."com.microsoft.sqlserver.jdbc.SQLServerDriver"
  healthCheckProperties...........{}
  healthCheckRegistry.............none
  idleTimeout.....................300000
  initializationFailFast..........true
  initializationFailTimeout.......1
  isolateInternalQueries..........false
  jdbc4ConnectionTest.............false
  jdbcUrl.........................jdbc:sqlserver://&lt;SERVER&gt;:&lt;PORT&gt;;database=&lt;database&gt;
  leakDetectionThreshold..........0
  maxLifetime.....................600000
  maximumPoolSize.................100
  metricRegistry..................none
  metricsTrackerFactory...........none
  minimumIdle.....................75
  password........................&lt;masked&gt;
  poolName........................"MyConnectionPool"
  readOnly........................false
  registerMbeans..................false
  scheduledExecutor...............none
  scheduledExecutorService........internal
  schema..........................none
  threadFactory...................internal
  transactionIsolation............default
  username........................"dbusername"
  validationTimeout...............5000
  </code></pre>
  
  <p>Logs</p>
  
  <pre><code>2019-05-15 12:55:28.572 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133785 ClientConnectionId: 5a2d0116-a8f9-4cd2-aab7-3138db1ea627: (connection was evicted)
  2019-05-15 12:55:28.615  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:28.661 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133873 ClientConnectionId: 1e729748-5f80-4a88-8545-e0ca16d1a34b
  2019-05-15 12:55:28.661 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After adding stats (total=76, active=1, idle=75, waiting=0)
  2019-05-15 12:55:42.192 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133798 ClientConnectionId: d3816606-8cb5-4b5e-8ca0-771fa877e2a2: (connection has passed maxLifetime)
  2019-05-15 12:55:45.478 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133797 ClientConnectionId: b464f02e-eed6-4f33-9b2a-c69e894c1611: (connection has passed maxLifetime)
  2019-05-15 12:55:45.484  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:45.530 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133874 ClientConnectionId: a02ef032-3a41-429c-b328-b0cd9b74ba15
  2019-05-15 12:55:46.482 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133796 ClientConnectionId: cb17a32d-234a-40a3-b0fb-617cac5158a1: (connection has passed maxLifetime)
  2019-05-15 12:55:46.486  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:46.552 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133875 ClientConnectionId: e3731254-71ac-4fd8-b304-19c71ebad2b6
  2019-05-15 12:55:47.131 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133801 ClientConnectionId: 1357d6e1-20ce-4a84-8143-2fb095fa7dbb: (connection has passed maxLifetime)
  2019-05-15 12:55:47.136  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:47.191 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133876 ClientConnectionId: 6ba7a1e7-52df-4719-a95c-fb5d67711aaa
  2019-05-15 12:55:48.834 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133800 ClientConnectionId: 3f872d11-1af4-47de-9e8c-51f8801ed750: (connection has passed maxLifetime)
  2019-05-15 12:55:48.838  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:48.890 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133877 ClientConnectionId: ae989f7c-d3fa-4ff0-9305-ebbbf393f558
  2019-05-15 12:55:50.271 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Before cleanup stats (total=75, active=0, idle=75, waiting=0)
  2019-05-15 12:55:50.271 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After cleanup  stats (total=75, active=0, idle=75, waiting=0)
  2019-05-15 12:55:50.955 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133799 ClientConnectionId: c71a7b65-b306-4385-81f5-6f264feb2d7b: (connection has passed maxLifetime)
  2019-05-15 12:55:50.959  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:51.026 DEBUG 17 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Added connection ConnectionID:133878 ClientConnectionId: 7db54029-a6a1-47e5-bae7-dc42c5a3cd5b
  2019-05-15 12:55:53.232 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133803 ClientConnectionId: e67f2293-726c-4651-afdb-c5d86cbbf208: (connection has passed maxLifetime)
  2019-05-15 12:55:53.237  INFO 17 --- [onnection adder] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
  2019-05-15 12:55:54.994 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133802 ClientConnectionId: 51fd57be-67a2-4a85-ad77-396e672a0bfb: (connection has passed maxLifetime)
  2019-05-15 12:55:56.913 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133804 ClientConnectionId: b6c81baf-0bf6-4002-9075-f1311c5eeb47: (connection has passed maxLifetime)
  2019-05-15 12:56:00.639 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133805 ClientConnectionId: 5b5abe04-23ac-468f-93be-1424b4f838ea: (connection has passed maxLifetime)
  2019-05-15 12:56:07.080 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133806 ClientConnectionId: 052f89a1-c9ba-4e8d-81e8-af884b19a260: (connection has passed maxLifetime)
  2019-05-15 12:56:07.515 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133807 ClientConnectionId: f5caa695-6c10-4edc-bf0d-9dc9a5bebbcd: (connection has passed maxLifetime)
  2019-05-15 12:56:09.517 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133809 ClientConnectionId: 3eb98771-b145-4788-be3f-0fe1ed20bc2e: (connection has passed maxLifetime)
  2019-05-15 12:56:11.496 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133808 ClientConnectionId: 3cb59458-f4ee-44f0-b89a-c041bab47f05: (connection has passed maxLifetime)
  2019-05-15 12:56:19.231 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133811 ClientConnectionId: e9ef4658-e86d-4d9d-b277-fe184bf91e1b: (connection has passed maxLifetime)
  2019-05-15 12:56:20.271 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Before cleanup stats (total=66, active=0, idle=66, waiting=0)
  2019-05-15 12:56:20.272 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After cleanup  stats (total=66, active=0, idle=66, waiting=0)
  2019-05-15 12:56:21.899 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133810 ClientConnectionId: 225d1741-f9ee-4eee-9781-6fedde1f58d1: (connection has passed maxLifetime)
  2019-05-15 12:56:26.133 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133816 ClientConnectionId: 6d2519eb-d5d2-40ee-b21e-861c65469ae7: (connection has passed maxLifetime)
  2019-05-15 12:56:28.199 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133812 ClientConnectionId: 9c6ed374-e198-49e4-993d-f941eafd90c8: (connection has passed maxLifetime)
  2019-05-15 12:56:33.284 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133814 ClientConnectionId: c228ddbc-a681-4840-b030-b21c1784ab44: (connection has passed maxLifetime)
  2019-05-15 12:56:34.444 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133817 ClientConnectionId: 166f9e66-dea6-4fdc-875e-8fd6a3e8d63e: (connection has passed maxLifetime)
  2019-05-15 12:56:35.498 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133813 ClientConnectionId: 19c35284-2e48-4dd9-b15e-a399693da5f4: (connection has passed maxLifetime)
  2019-05-15 12:56:38.204 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133815 ClientConnectionId: 55ec82d6-1768-4dec-a9c6-5066e5a49010: (connection has passed maxLifetime)
  2019-05-15 12:56:43.244 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133818 ClientConnectionId: f6bd0e08-82e7-4a3b-855b-b687b637cc54: (connection has passed maxLifetime)
  2019-05-15 12:56:43.401 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133821 ClientConnectionId: 2d231ef2-3bda-48d2-b273-bb6baa6460eb: (connection has passed maxLifetime)
  2019-05-15 12:56:45.232 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133819 ClientConnectionId: f3d57bb6-1216-495a-ab96-66037700a410: (connection has passed maxLifetime)
  2019-05-15 12:56:49.309 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133822 ClientConnectionId: 67e255ee-3b2e-4b60-8f92-29f392545365: (connection has passed maxLifetime)
  2019-05-15 12:56:50.272 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Before cleanup stats (total=55, active=0, idle=55, waiting=0)
  2019-05-15 12:56:50.272 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After cleanup  stats (total=55, active=0, idle=55, waiting=0)
  2019-05-15 12:56:51.507 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133820 ClientConnectionId: a9f80ef0-4dd8-4e89-b825-5b00290f7139: (connection has passed maxLifetime)
  2019-05-15 12:57:04.483 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133824 ClientConnectionId: 98796f7d-76e5-425c-a2eb-e43f7baf64df: (connection has passed maxLifetime)
  2019-05-15 12:57:05.515 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133825 ClientConnectionId: 60f39474-91b3-4fa3-8659-5d20507be6eb: (connection has passed maxLifetime)
  2019-05-15 12:57:06.123 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133823 ClientConnectionId: 890ea5e0-cb0e-4411-9d9f-829cb6d9cba6: (connection has passed maxLifetime)
  2019-05-15 12:57:12.578 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133826 ClientConnectionId: 4742bb54-0efb-424b-a369-e3fb927ea2ab: (connection has passed maxLifetime)
  2019-05-15 12:57:20.272 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Before cleanup stats (total=50, active=0, idle=50, waiting=0)
  2019-05-15 12:57:20.273 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After cleanup  stats (total=50, active=0, idle=50, waiting=0)
  2019-05-15 12:57:28.559 DEBUG 17 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase          : MyConnectionPool - Closing connection ConnectionID:133827 ClientConnectionId: d7a702e4-0a2e-4768-b402-23655fa1c9af: (connection has passed maxLifetime)
  2019-05-15 12:57:50.273 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - Before cleanup stats (total=49, active=0, idle=49, waiting=0)
  2019-05-15 12:57:50.273 DEBUG 17 --- [ool housekeeper] com.zaxxer.hikari.pool.HikariPool        : MyConnectionPool - After cleanup  stats (total=49, active=0, idle=49, waiting=0)
  </code></pre>
  
  <p>Wondering if anyone here has faced this issue before and can help me with the solution.</p>