This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes DBCP deadlock on BasicDataSource.getConnection() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "DBCP deadlock on BasicDataSource.getConnection()" Watch "DBCP deadlock on BasicDataSource.getConnection()" New topic
Author

DBCP deadlock on BasicDataSource.getConnection()

Dennis Franklin
Greenhorn

Joined: Apr 26, 2011
Posts: 3
Anyone ever seen this before? A bunch of threads in Tomcat is stuck trying to get a connection:



Seems like its a deadlock, but I'm not sure how this is happening.
Pierre-Hugues Charbonneau
Greenhorn

Joined: Feb 05, 2011
Posts: 9
Hi Dennis,

This normally means that your Tomcat Pool is running out of Connection. At that point Tomcat ObjectPool code will start to wait until a Connection is available.

Do you see other Threads involved in actual database transactions or just waiting to acquire a Connection? Also, what are your current Tomcat settings for this particular data source?

Possible scenarios:

- Database hanging scenario causing rapid depletion of your Tomcat JDBC Data Source (long running query, database slowdown condition, too much load vs. tuning etc.)
- JDBC DataSource/Connection leak

At this point, please provide more detail on other Threads from your captured Thread Dump so we can pinpoint the root cause as per process below:

- Breakdown Thread Dump in logical silos:
- What is the total # of active Threads (executing a request)
- What is the total # of Threads waiting to acquire a Connection from your JDBC DataSource
- What is the total # of Threads involved in an actual transaction with your JDBC DataSource

Regards,
P-H
http://javaeesupportpatterns.blogspot.com/
Dennis Franklin
Greenhorn

Joined: Apr 26, 2011
Posts: 3
Thanks Pierre-Hugues for the insight. I had completely forgotten to set the connection pool size settings. Added maxActive and maxIdle resolved the issue.

Just out of curiosity, what's the default maxActive if it is not set?
 
Have you checked out Aspose?
 
subject: DBCP deadlock on BasicDataSource.getConnection()
 
It's not a secret anymore!