When PooledConnectionSource$Poller checks whether connections are still alive, it takes all available connections offline so they cannot be used until they have been tested one-by-one.
If by chance a new connection is required before any of the connections are returned to the pool, then a new connection will be created unconditionally as long as the pool size is not exceeded.
In our production environment, this unlikely event happens up to 6 times per day. This means our pool size grows by about 6 connections per day (42 connections per week!) even though the load never justifies such a pool size.
This fix stops this from happening. When a connection is required but there are no connections available, it will wait() if there are connections being tested.
Patch for PooledConnectionSource