You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@manifoldcf.apache.org by Markus Schuch <ma...@web.de> on 2015/06/23 18:37:56 UTC

Deadlock in JDBC ConnectionPool

Hi,

i tested CONNECTORS-1202 (stale connection check) and i encounter a dead lock in the connection pool when i simulate a database outage. 

I use ManifoldCF 1.7.1 with CONNECOTRS-1202 patch applied an MySQL as Database.

Steps for reproduction :

1. Start ManifoldCF with a limited ConnectionPool Max size of 5
2. When everything is running stop the database
3. Wait for connection exeptions to occur
4. Click around in the ui to start more threads that want to aquire a connection
5. Everything freezes 
6. Start the database
7. Still everything is freezed. no recovery is happening.

As far as i understand the ConnectionPool implementation, the problem is that the activeConnections counter is not decremented when the DriverManager fails to get a Connection. On every failed DriverManager.getConnection call the pool gets more and more 'exhausted'. When activeConnections hits the size limit, threads go to Object.wait(). But notifyAll will never be called because there is no outstanding connection to return.

Regards,
Markus

Re: Deadlock in JDBC ConnectionPool

Posted by Markus Schuch <ma...@web.de>.
Thanks Karl.

i cannot reproduce the problem with the new patch.
Looks good.

Regards,
Markus

Am 24.06.2015 02:58, schrieb Karl Wright:
> patch was attached earlier today.
> 
> Karl
> 
> On Tue, Jun 23, 2015 at 1:06 PM, Karl Wright <daddywri@gmail.com
> <ma...@gmail.com>> wrote:

Re: Deadlock in JDBC ConnectionPool

Posted by Karl Wright <da...@gmail.com>.
patch was attached earlier today.

Karl

On Tue, Jun 23, 2015 at 1:06 PM, Karl Wright <da...@gmail.com> wrote:

> I've reopened the ticket and will attach an additional patch.
> Karl
>
> On Tue, Jun 23, 2015 at 12:37 PM, Markus Schuch <ma...@web.de>
> wrote:
>
>> Hi,
>>
>> i tested CONNECTORS-1202 (stale connection check) and i encounter a dead
>> lock in the connection pool when i simulate a database outage.
>>
>> I use ManifoldCF 1.7.1 with CONNECOTRS-1202 patch applied an MySQL as
>> Database.
>>
>> Steps for reproduction :
>>
>> 1. Start ManifoldCF with a limited ConnectionPool Max size of 5
>> 2. When everything is running stop the database
>> 3. Wait for connection exeptions to occur
>> 4. Click around in the ui to start more threads that want to aquire a
>> connection
>> 5. Everything freezes
>> 6. Start the database
>> 7. Still everything is freezed. no recovery is happening.
>>
>> As far as i understand the ConnectionPool implementation, the problem is
>> that the activeConnections counter is not decremented when the
>> DriverManager fails to get a Connection. On every failed
>> DriverManager.getConnection call the pool gets more and more 'exhausted'.
>> When activeConnections hits the size limit, threads go to Object.wait().
>> But notifyAll will never be called because there is no outstanding
>> connection to return.
>>
>> Regards,
>> Markus
>>
>
>

Re: Deadlock in JDBC ConnectionPool

Posted by Karl Wright <da...@gmail.com>.
I've reopened the ticket and will attach an additional patch.
Karl

On Tue, Jun 23, 2015 at 12:37 PM, Markus Schuch <ma...@web.de>
wrote:

> Hi,
>
> i tested CONNECTORS-1202 (stale connection check) and i encounter a dead
> lock in the connection pool when i simulate a database outage.
>
> I use ManifoldCF 1.7.1 with CONNECOTRS-1202 patch applied an MySQL as
> Database.
>
> Steps for reproduction :
>
> 1. Start ManifoldCF with a limited ConnectionPool Max size of 5
> 2. When everything is running stop the database
> 3. Wait for connection exeptions to occur
> 4. Click around in the ui to start more threads that want to aquire a
> connection
> 5. Everything freezes
> 6. Start the database
> 7. Still everything is freezed. no recovery is happening.
>
> As far as i understand the ConnectionPool implementation, the problem is
> that the activeConnections counter is not decremented when the
> DriverManager fails to get a Connection. On every failed
> DriverManager.getConnection call the pool gets more and more 'exhausted'.
> When activeConnections hits the size limit, threads go to Object.wait().
> But notifyAll will never be called because there is no outstanding
> connection to return.
>
> Regards,
> Markus
>