tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anu Prab <>
Subject Re: Reg: Connection pool stats
Date Thu, 14 Nov 2013 07:23:19 GMT
On Nov 11, 2013, at 12:59 AM, Anu Prab <> wrote:

> On Nov 7, 2013, at 11:58 PM, Anu Prab <> wrote:
>>>> I am using Tomcat 7.0.42 and Tomcat jdbc pool.
>>> Just to be perfectly clear, how are you using this?  With a <Resource/>
>> tag in your Tomcat >configuration or are you creating the pool in your
>> code?  Either way, include the necessary >config or code which shows how
>> you've defined the pool.
>>> The pool configuration is in context.xml. A sample of the config looks
> like
>> this:
>>> <Resource name="jdbc/name"
>>>             auth="Container"
>>>            type="javax.sql.DataSource"
>>>             fairQueue="true"
>>>            factory="<customized-factory>"

>>>              timeBetweenEvictionRunsMillis="1800000"

>>>              validationQuery="SELECT 1 from dual"

>>>              validationInterval="30000"

>>>              maxActive="50"

>>>             minIdle="4"

>>>              maxIdle="4"

>>>              maxWait="10000"

>>>            initialSize="4"

>>>            removeAbandonedTimeout="60"

>>>             removeAbandoned="true"

>>>             logAbandoned="false"

>> What factory are you using?  It's important to share.  Without it we
> know which pool you're using.
>> A customized factory which extends org.apache.tomcat.jdbc.pool.
>> DataSourceFactory
>> Few minutes, not sure of the exact timing. Yes, all are 0.
>> Also, what happens when you try to get a connection after the pool count
>> has dropped to 0?  >Does it get a new connection?  Does it hang waiting?
>> Does it generate any error messages?
>>> Is there any reason why you might be getting disconnected from the
>>> database side or from a >firewall in between your application and the
>>> database?
>> I can still get newer connections even after the count drops to 0.
>> Hi,
>> Also, when I enabled logAbandoned as you suggested, I see this exception
>> after about 17-18 minutes.
>> org.apache.tomcat.jdbc.pool.ConnectionPool abandon
>> WARNING: Connection has been abandoned
>> PooledConnection[oracle.jdbc.driver.T4CConnection@2726965a
>> ]:java.lang.Exception
>>        at
>>        at
>>        at
>>        at

> This explains the behavior that you're seeing.  It appears that your
connections are being >flagged as abandoned and thus removed from the pool.

>Take a look at the generated stack trace and see what part of your code is
holding onto the >connection.  This could be legitimate, in the case where
you have a long running process (like a >batch job) or it could be a code
error (like you don't have proper try..catch..finally blocks setup >to
close connections).

> Dan


The problem that we are facing now is that the connections are showing idle
when they are not being used. When we queried the gv$session table in the
database, we could still find the entry of this inactive/idle connection.
They are not being "recycled" after the min idle and eviction time had
We think this is happening because the validation query runs and makes the
query "unidle" and hence the eviction does not pick it up. Is it so? Please


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