You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by "Husek, Paul" <Pa...@pfizer.com> on 2004/09/24 22:06:06 UTC

Connection leak

Hello,

 

I'm using Torque v3.1 with commons-dbcp connection pooling.  I'm getting
what I believe is a connection leak.  After a certain time of my application
being up and responsive it just hangs.

 

Is there anyway I can verify this?  E.g. Can I see how many connections are
left in the pool, how many have been taken and not returned, etc? In some
places I do a Torque.getConnection() but may not be returning them.  Can I
cause them to be reaped automatically if I forget to return them?

 

 

Paul

 


Re: Connection leak

Posted by T E Schmitz <ma...@numerixtechnology.de>.
Hello Ian,
Thank you for your help. Indeed, I am using dbcp 1.1 (this is what
shipped with Torque 3.1 I think). I downloaded commons-dbcp 1.2 and
commons-pool 1.2 when it was released but haven't used it yet.

Is it correct that dbcp 1.2 requires pool 1.2?

Ian Ragsdale wrote:

> I have been using those values with the SharedPoolDataSourceFactory.  
> Perhaps your version of the dbcp is older than the one we are using and 
> doesn't support these settings?  We are using commons-dbcp-1.2.1.jar - 
> perhaps you could get a newer one and see if that works.
> 
> Ian
> 
> On Sep 24, 2004, at 3:48 PM, T E Schmitz wrote:
> 
>> Hello Ian,
>>
>> When I set any of these properties (maxWait, maxActive, 
>> removeAbandoned, logAbandoned), I get an error:
>>
>> Category:org.apache.torque.dsfactory.AbstractDataSourceFactory
>> Message:Property: maxActive value: 10 is not supported by DataSource: 
>> org.apache.commons.dbcp.datasources.PerUserPoolDataSource
>>
>> and so forth.


-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz



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


Re: Connection leak

Posted by Ian Ragsdale <ia...@SKYLIST.net>.
I have been using those values with the SharedPoolDataSourceFactory.  
Perhaps your version of the dbcp is older than the one we are using and 
doesn't support these settings?  We are using commons-dbcp-1.2.1.jar - 
perhaps you could get a newer one and see if that works.

Ian

On Sep 24, 2004, at 3:48 PM, T E Schmitz wrote:

> Hello Ian,
>
> Ian Ragsdale wrote:
>
>> We recently had a similar problem.  Here's what we did, which 
>> appeared to alleviate the problem without addressing the underlying 
>> connection leak:
>> # don't wait indefinitely for a connection
>> torque.dsfactory.scimitar.pool.maxWait = 5000
>> # allow up to 25 connections in the pool (up from 8)
>> torque.dsfactory.scimitar.pool.maxActive = 25
>> # remove connections that have been abandoned
>> torque.dsfactory.scimitar.pool.removeAbandoned = true
>
> When I set any of these properties (maxWait, maxActive, 
> removeAbandoned, logAbandoned), I get an error:
>
> Category:org.apache.torque.dsfactory.AbstractDataSourceFactory
> Message:Property: maxActive value: 10 is not supported by DataSource: 
> org.apache.commons.dbcp.datasources.PerUserPoolDataSource
>
> and so forth.
>
> I had the same problems with SharedPoolDataSourceFactory
>
> Hence I have not played around with these settings any further.
> Does anybody understand which properties are available when?
>
> -- 
>
>
> Regards/Gruß,
>
> Tarlika Elisabeth Schmitz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Re: Connection leak

Posted by T E Schmitz <ma...@numerixtechnology.de>.
Hello Ian,

Ian Ragsdale wrote:

> We recently had a similar problem.  Here's what we did, which appeared 
> to alleviate the problem without addressing the underlying connection leak:
> 
> # don't wait indefinitely for a connection
> torque.dsfactory.scimitar.pool.maxWait = 5000
> 
> # allow up to 25 connections in the pool (up from 8)
> torque.dsfactory.scimitar.pool.maxActive = 25
> 
> # remove connections that have been abandoned
> torque.dsfactory.scimitar.pool.removeAbandoned = true
> 

When I set any of these properties (maxWait, maxActive, removeAbandoned, 
logAbandoned), I get an error:

Category:org.apache.torque.dsfactory.AbstractDataSourceFactory
Message:Property: maxActive value: 10 is not supported by DataSource: 
org.apache.commons.dbcp.datasources.PerUserPoolDataSource

and so forth.

I had the same problems with SharedPoolDataSourceFactory

Hence I have not played around with these settings any further.
Does anybody understand which properties are available when?

-- 


Regards/Gruß,

Tarlika Elisabeth Schmitz

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


Re: Connection leak

Posted by Ian Ragsdale <ia...@SKYLIST.net>.
We recently had a similar problem.  Here's what we did, which appeared 
to alleviate the problem without addressing the underlying connection 
leak:

# don't wait indefinitely for a connection
torque.dsfactory.scimitar.pool.maxWait = 5000

# allow up to 25 connections in the pool (up from 8)
torque.dsfactory.scimitar.pool.maxActive = 25

# remove connections that have been abandoned
torque.dsfactory.scimitar.pool.removeAbandoned = true

This should postpone running out of connections by adding more and give 
the pool time to reclaim abandoned connections.  There is also a 
setting to have it track where connections are leaked from, at the 
expense of a little overhead when opening connections:

logAbandoned = true

More configuration settings are here:

http://jakarta.apache.org/commons/dbcp/configuration.html

On Sep 24, 2004, at 3:06 PM, Husek, Paul wrote:

> Hello,
>
> I'm using Torque v3.1 with commons-dbcp connection pooling.  I'm 
> getting
> what I believe is a connection leak.  After a certain time of my 
> application
> being up and responsive it just hangs.
>
> Is there anyway I can verify this?  E.g. Can I see how many 
> connections are
> left in the pool, how many have been taken and not returned, etc? In 
> some
> places I do a Torque.getConnection() but may not be returning them.  
> Can I
> cause them to be reaped automatically if I forget to return them?
>
>
>
>
>
> Paul
>
>
>


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


Re: Connection leak

Posted by Ian Ragsdale <ia...@SKYLIST.net>.
If you tell the JVM to do a thread dump (kill -3 on unix systems, not 
sure on windows, prints to stdout) you can see your threads stuck 
waiting on the connection pool.  That would be one way to verify that 
this is in fact the problem.

Ian

On Sep 27, 2004, at 10:04 AM, Guy Galil wrote:

> This might be pointing to the obvious but still:
> when you use Connection con = Torque.getConnection();
> make sure you have a finally clause with Torque.closeConnection(con);
>
> On Fri, 2004-09-24 at 16:06, Husek, Paul wrote:
>> Hello,
>>
>>
>>
>> I'm using Torque v3.1 with commons-dbcp connection pooling.  I'm 
>> getting
>> what I believe is a connection leak.  After a certain time of my 
>> application
>> being up and responsive it just hangs.
>>
>>
>>
>> Is there anyway I can verify this?  E.g. Can I see how many 
>> connections are
>> left in the pool, how many have been taken and not returned, etc? In 
>> some
>> places I do a Torque.getConnection() but may not be returning them.  
>> Can I
>> cause them to be reaped automatically if I forget to return them?
>>
>>
>>
>>
>>
>> Paul
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Re: Connection leak

Posted by Guy Galil <gu...@guardium.com>.
This might be pointing to the obvious but still:
when you use Connection con = Torque.getConnection();
make sure you have a finally clause with Torque.closeConnection(con);

On Fri, 2004-09-24 at 16:06, Husek, Paul wrote:
> Hello,
> 
>  
> 
> I'm using Torque v3.1 with commons-dbcp connection pooling.  I'm getting
> what I believe is a connection leak.  After a certain time of my application
> being up and responsive it just hangs.
> 
>  
> 
> Is there anyway I can verify this?  E.g. Can I see how many connections are
> left in the pool, how many have been taken and not returned, etc? In some
> places I do a Torque.getConnection() but may not be returning them.  Can I
> cause them to be reaped automatically if I forget to return them?
> 
>  
> 
> 
> 
> Paul
> 
>  
> 


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