[Deploying Sakai] possible dbcp issue

Charles Hedrick hedrick at rutgers.edu
Wed Sep 9 15:31:33 PDT 2009


We're seeing an odd kind of loss of database connections in 2.6. This  
is mysql 4.1, Java 6, and the dbcp/pool shipped with 2.6 (1.2.2 and  
1.3).

We disable all dynamic adjustment and ask for 300 connections. After a  
few days we have 275 idle and 25 in use. "netstat -n -a | grep 3306"  
shows only 275 connections. Of course 275 is still plenty, but I worry  
about the trend.

It looks to me like those 25 "in use" actually are lost in some odd  
way. I don't see how Sakai could be doing it, as Sakai would just  
return connections to the pool, not close them. Maybe mysql is someone  
closing the connections, but (1) I can't see why it would; it didn't  
with 2.5 (2) you'd think Sakai would still return the connection, and  
it wouid no longer show as in use.

I can't help suspecting a possible issue with dbcp/pool.

I'd appreciate if if you'd try the attached jsp and see if the total  
of active and idle matches the number of connections shown by netstat.

I'm thinking of running a job nightly that checks the number of  
connections with netstat, and creates additional connections in the  
pool as needed. Doing so requires some magic, but not much. (The  
problem is that you need to get to the underlying GenericObjectPool,  
which is a protected field of the BasicDataSource. It turns out that  
using introspection, you can access protected fields.)

I'm coming close to writing my own pool code. We tried c3po a couple  
of years ago and it was no better. If you implement a single, simple  
strategy, it's easy enough to do.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pool.jsp
Type: application/octet-stream
Size: 1942 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/production/attachments/20090909/bb478836/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2421 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/production/attachments/20090909/bb478836/attachment.bin 


More information about the production mailing list