commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Rosenvold <>
Subject Re: [DBCP] Apparent deadlock related to getConnection
Date Sun, 12 Apr 2015 11:18:17 GMT
I once had a library that allocated 2 connections to complete a
transaction. Every now and then we'd deadlock the pool if number of
concurrent transactions > pool size, which could happen in load
bursts. If you do a thread dump of your process and see "all" threads
are waiting for a connection this is most probably happening. The
non-solution solution is to increase pool size, the real solution was
never to allocate 2 connections to complete a transaction.


2015-04-12 11:58 GMT+02:00 Shawn Heisey <>:
> On 4/11/2015 8:48 AM, Phil Steitz wrote:
>> What is going on in that thread is that it is blocked waiting for a
>> connection to become available in the pool.  There is no evidence of
>> deadlock there - just pool exhaustion.
>> The most likely culprit is application code that is failing to close
>> connections that have been borrowed from the pool.  If you don't
>> close the connections on all execution paths, they will "leak" as
>> the pool has no way of knowing that your code is finished with them
>> unless and until you close them.
> I've done a review of all my database code for leaks in the past, and
> everything looked good at that time.  I can repeat that check.  The
> database portions of my code have not had any changes for quite some time.
> Would I see evidence of a connection leak in the "show full processlist"
> output at the MySQL server?  I don't see that happening.  There are only
> a handful of open connections when I check there, even when the program
> has been running for several days or weeks, running through its cycle
> once a minute.  Once all parts of the program have been run at least
> once, the connection count is stable.
> Thanks,
> Shawn
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message