We had pool exhaustion running rampant, so we traced how things work, and found a bug. A really bad one, I think. I can't imagine how anyone is using JDBCConnectionPools under 2.4.8 or there-abouts.
ObjectPool.releaseObject() at on point does this:
try
{
factory.returnObject(object);//do this first
pooled = factory.translateObject(object);
} catch(Exception e)
{
return; // We can't release it if the factory can't recognize it
}
if(pooled == null) // We can't release it if the factory can't recognize it
return
Glance at the way the JDBCConnectionFactory and ConnectionInPool stuff works, and you'll see that (pooled == null) will always be true. The important parts of returning the object to the pool never happen.
Anyone else noticed this?
Note, it is easy to make this happen. Just write a loop, and it'll exhaust your pool:
for (int i = 0; i <= maxPool; i++)
Connection con = ds.getConnection();
con.close();
}
(maxPool being the MaxSize you set for your pool).
I'll be submitting a bug report and potential patch on sf.net.