You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Niall Gallagher <ni...@voxsurf.com> on 2007/01/19 11:36:08 UTC

DBCP connection pool problem

Hi All,

I am using the latest commons DBCP library (1.2.1) as our connection 
pooling solution for an Oracle DB. However I am encountering a strange 
issue where under certain conditions DBCP seems to open an excessive 
amount of connections to the DB. We are not sure exactly what is causing 
the problem but we suspect that it is the Evictor task within the 
commons-pool library.

When the issue occurs the TNS listener logs for Oracle show an massive 
growth in the number of connections being attempted. For instance here 
is the activity over a couple of minutes.

03-JAN-2007, 16:48, db1, 192.168.1.35, 52858
03-JAN-2007, 16:49, db1, 192.168.1.35, 61696
03-JAN-2007, 16:50, db1, 192.168.1.35, 61107
03-JAN-2007, 16:51, db1, 192.168.1.35, 61475
03-JAN-2007, 16:52, db1, 192.168.1.35, 61446

On average about 60,000 connections a minute. We are quite certain this 
is caused by DBCP as this is the only means of accessing DB connections 
within our applications and we log before and after the 
DataSource.getConnection method (our logs show no repetitive log 
statements).  Has anyone seen such an issue before? Any help on this 
would be greatly appreciated.

Thanks,
Niall




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DBCP connection pool problem

Posted by Niall Gallagher <ni...@voxsurf.com>.
Hi,

Yep, the issue we were seeing was caused when the eviction time was too 
low, this needs to be kept higher than a couple of seconds (I would 
recomend 30). This causes problems in two scenarios:

1) When starting up the min idle was created twice
2) When eviction took place the evictor evicted idle connections then 
forced the pool back up to min idle which caused a cycle of connections 
to be created

Also, we noticed a slight bug in our code which made the problem worse. 
We created too many DataSource objects due to a slight synchronization 
bug. This caused us to create several data sources, all of which had a 
configured eviction time of about 500 ms, this caused many 
evictions/creations every second and thats what caused our problem

Niall


Ravi116 wrote:
> Niall,
>
> I am encountering a similar issue with DB2. Running our appln inside of
> Tomcat/Spring JDBC. Niall - Did u resolve/find out more abt the issue ? Any
> help is appreciated.
>
>
> Ravi
>
>
> Niall Gallagher-3 wrote:
>   
>> Hi All,
>>
>> I am using the latest commons DBCP library (1.2.1) as our connection 
>> pooling solution for an Oracle DB. However I am encountering a strange 
>> issue where under certain conditions DBCP seems to open an excessive 
>> amount of connections to the DB. We are not sure exactly what is causing 
>> the problem but we suspect that it is the Evictor task within the 
>> commons-pool library.
>>
>> When the issue occurs the TNS listener logs for Oracle show an massive 
>> growth in the number of connections being attempted. For instance here 
>> is the activity over a couple of minutes.
>>
>> 03-JAN-2007, 16:48, db1, 192.168.1.35, 52858
>> 03-JAN-2007, 16:49, db1, 192.168.1.35, 61696
>> 03-JAN-2007, 16:50, db1, 192.168.1.35, 61107
>> 03-JAN-2007, 16:51, db1, 192.168.1.35, 61475
>> 03-JAN-2007, 16:52, db1, 192.168.1.35, 61446
>>
>> On average about 60,000 connections a minute. We are quite certain this 
>> is caused by DBCP as this is the only means of accessing DB connections 
>> within our applications and we log before and after the 
>> DataSource.getConnection method (our logs show no repetitive log 
>> statements).  Has anyone seen such an issue before? Any help on this 
>> would be greatly appreciated.
>>
>> Thanks,
>> Niall
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>>
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DBCP connection pool problem

Posted by Ravi116 <ra...@countrywide.com>.
Niall,

I am encountering a similar issue with DB2. Running our appln inside of
Tomcat/Spring JDBC. Niall - Did u resolve/find out more abt the issue ? Any
help is appreciated.


Ravi


Niall Gallagher-3 wrote:
> 
> Hi All,
> 
> I am using the latest commons DBCP library (1.2.1) as our connection 
> pooling solution for an Oracle DB. However I am encountering a strange 
> issue where under certain conditions DBCP seems to open an excessive 
> amount of connections to the DB. We are not sure exactly what is causing 
> the problem but we suspect that it is the Evictor task within the 
> commons-pool library.
> 
> When the issue occurs the TNS listener logs for Oracle show an massive 
> growth in the number of connections being attempted. For instance here 
> is the activity over a couple of minutes.
> 
> 03-JAN-2007, 16:48, db1, 192.168.1.35, 52858
> 03-JAN-2007, 16:49, db1, 192.168.1.35, 61696
> 03-JAN-2007, 16:50, db1, 192.168.1.35, 61107
> 03-JAN-2007, 16:51, db1, 192.168.1.35, 61475
> 03-JAN-2007, 16:52, db1, 192.168.1.35, 61446
> 
> On average about 60,000 connections a minute. We are quite certain this 
> is caused by DBCP as this is the only means of accessing DB connections 
> within our applications and we log before and after the 
> DataSource.getConnection method (our logs show no repetitive log 
> statements).  Has anyone seen such an issue before? Any help on this 
> would be greatly appreciated.
> 
> Thanks,
> Niall
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DBCP-connection-pool-problem-tf3039220.html#a10857802
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: DBCP connection pool problem

Posted by Ravi116 <ra...@countrywide.com>.
This dosent seem to be my problem since the evictor threads runs every 30
mins (default) and evicts 3 connections. The condition in my case is
connections are created in large chunks (30+) rather than incrementally.
Below are my connection parameters  - 

        <property name="initialSize" value="2" />
        <property name="poolPreparedStatements" value="true" />
        <property name="maxOpenPreparedStatements" value="3" />
        <property name="minIdle" value="2" />
        <property name="maxIdle" value="-1" />
        <property name="maxActive" value="200" />
        <property name="testWhileIdle" value="true" />
        <property name="testOnBorrow" value="false" />     
        <property name="timeBetweenEvictionRunsMillis" value="1800000" />
        <property name="validationQuery"
            value="select 1 from sysibm/sysdummy1 for read only" />

Tomcat and SpringJDBC is used. After tracing with log statements, it seems
to be like borrowObject() on GenericPoolObject is making all the
connections.  From the last run, the connection were added in batches  
Initial size - 2 (bfore test started)
Increased number of connections - 29 (~2 mins into the test)
Increased number of connections - 151 (~10 mins into the test).

This test is run on IBM AIX JDK version 1.5.X.

Any help is appreciated,

Ravi



Niall Gallagher-3 wrote:
> 
> Hi All,
> 
> I am using the latest commons DBCP library (1.2.1) as our connection 
> pooling solution for an Oracle DB. However I am encountering a strange 
> issue where under certain conditions DBCP seems to open an excessive 
> amount of connections to the DB. We are not sure exactly what is causing 
> the problem but we suspect that it is the Evictor task within the 
> commons-pool library.
> 
> When the issue occurs the TNS listener logs for Oracle show an massive 
> growth in the number of connections being attempted. For instance here 
> is the activity over a couple of minutes.
> 
> 03-JAN-2007, 16:48, db1, 192.168.1.35, 52858
> 03-JAN-2007, 16:49, db1, 192.168.1.35, 61696
> 03-JAN-2007, 16:50, db1, 192.168.1.35, 61107
> 03-JAN-2007, 16:51, db1, 192.168.1.35, 61475
> 03-JAN-2007, 16:52, db1, 192.168.1.35, 61446
> 
> On average about 60,000 connections a minute. We are quite certain this 
> is caused by DBCP as this is the only means of accessing DB connections 
> within our applications and we log before and after the 
> DataSource.getConnection method (our logs show no repetitive log 
> statements).  Has anyone seen such an issue before? Any help on this 
> would be greatly appreciated.
> 
> Thanks,
> Niall
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/DBCP-connection-pool-problem-tf3039220.html#a10863746
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org