commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cyrille Roy <>
Subject Re: Deadlock in DBCP and Pooling
Date Tue, 22 Dec 2009 08:47:01 GMT

agree with Mark.
If you did not setup maxActive, default value is 8, see
you can set it to -1, but I strongly discourage this because you will 
not see connection leak and you will damage both java server and database.

you should consider:
- doing a thread dump (use sudo kill -3 on Linux or Ctrl+Break on Windows)
- use netstat -ap | grep ... to check number of established cnx and who 
is using them
- setting maxWait to 1000 for example so you get an exception after 1000 
ms if the pool is exhausted. For it will help for debug purpose at least 
to check weither you have contention (you will get few exceptions) or 
deadlock (you will get non stopping exceptions)

Note that there is a contention issue on previous pool implementation.


Mark Thomas wrote:
> On 19/12/2009 00:02, Pawan Singh wrote:
>> I am getting a deadlock in the following place very occasionally. My code is
>> set up exactly as the examples suggest on the DBCP site.
>> The code seems to be deadlocked at:
>> GenericObjectPool.borrowObject() line:1104  <--- this code is in
>> WHEN_EXHAUSTED_BLOCK and is waiting on latch.wait().
>> PoolingDataSource.getConnection() line: 96
>> My set up does not initialize the max or min connections at all with the
>> understanding that the pool will allocate new connections as needed. Is the
>> deadlock caused by the fact that someone did not return the connection to
>> the pool and there is a max limit on it? How do I find how many connections
>> are in the pool and who is using them?
>> One last piece of information - I am using DBCP and Pool in a J2SE app.
> Do you mean deadlocked or blocked. There is a difference. A thread dump
> would help considerably here.
> What versions are dbcp and pool are you using?
> Mark
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message