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 JSP)?
Thanks,
Joe