cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <>
Subject Re: Cayenne Connection Pool Monitoring - to solve "out of connections" error
Date Wed, 12 May 2010 15:17:33 GMT

I am not sure I follow you.

While I am not an expert on stack traces, the "out of connections" exception was discovered
by perusing the Catalina logs for errors near the time that the loading-delays occurred. 
This generated a pretty detailed stack trace of its own, (which revealed nothing more than
MySQL was reporting that there were no more open connections).

1. Will this thread dump report anything that the MySQL exception does not?
2. DriverDataSourceFactory - I was actually looking for something that was more "data-pull"
than "data-push", i.e. I would like to query the connection pool class to return information
at the moment it is requested.


On May 12, 2010, at 10:45 AM, Andrus Adamchik wrote:

> Don't remember if you went through that already, but the easiest thing you can do to
understand what's going on is to take a thread dump of the running (stuck) application.
> There are other debugging options available (such as subclassing DriverDataSourceFactory
to log when connections are opened and closed), but try the thread dump first.
> Andrus
> On May 12, 2010, at 5:39 PM, Joe Baldwin wrote:
>> This is a follow-up on the "out of connections" error I am periodically receiving
from the production MySQL DBMS.
>> If you will recall, where we left it was that the evidence appears to support the
interim conclusion that it is not Cayenne and that it may be the JDBC Driver or even MySQL.
>> Actions Taken (based on previous input):
>> I upgraded the connector to "mysql-connector-java-5.1.12" and the MySQL server was
reluctantly upgraded by the webhost tech-person to "MySQL/5.0.88"  (it appears they do not
like MySQL 5.1 for some reason).  I also perused my code for any "open" connections (which
I am not sure that I have any control over since all DBMS connections are managed by Cayenne).
>> Results:
>> It appears that the problem continues.  It even occurs with *very* light usage. There
does not seem to be any obvious trigger. This causes sever symptoms of a request for a webpage
taking 30-60 sec to load.  (It appears that the 10 used-connections somehow magically allow
the user to access after this 30-60 sec delay.  ????????????)
>> Question:
>> I am pretty good at tracking down bugs, but this one is really difficult to devise
a methodical plan to solve.  My only idea right now is to monitor the Cayenne managed connection
pool (with the hopes that I can monitor open connections and associate these connections with
the cause).  I have not been able to figure out how to do this via the Cayenne API.  I am
convinced that monitoring this connection pool will provide insight into a problem.
>> Therefore: can you provide some example code of how to monitor open (and closed)
connections in the Cayenne managed connection pool (so that I can display the result in a
>> Thanks,
>> Joe

View raw message