tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sasidhar prabhakar <sasidhar1...@gmail.com>
Subject Re: DBCP abandoned trace - unable to understand the leak
Date Mon, 08 Nov 2010 05:31:54 GMT
On Thu, Nov 4, 2010 at 9:10 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Sasidhar,
>
> On 11/4/2010 8:34 AM, sasidhar prabhakar wrote:
> > The class is fine but in log it is showing this one. Here everything
> closed
> > fine.
> > Then why it is showing like this
> >
> > DBCP object created 2010-11-04 11:07:59 by the following code was never
> > closed:
>
> I have found that these exceptions can occur even when there is no leak.
>
> Specifically, if your SQL query takes a long time to run (that is, more
> than the ababdonedTimeout), another request to the connection pool
> complains about the connection and calls it abandoned.
>

I think your right. Timeout  I mentioned 30sec deafault is 300sec. This is
my context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="" >
<Resource
accessToUnderlyingConnectionAllowed="true"
auth="Container"
driverClassName="oracle.jdbc.OracleDriver"
  maxActive="200"
  maxIdle="10"
  maxWait="8000"
validationQuery="SELECT * from dual"
testOnBorrow="true"
removeAbandoned="true"
removeAbandonedTimeout="30"
logAbandoned="true"
name="jdbc/ds"
password="*******"
type="javax.sql.DataSource"
url="jdbc:oracle:thin:@localhost.localdomain:1521:amulyam"
username="scott"/>
<Resource auth="Container" name="mail/Session" type="javax.mail.Session"
mail.smtp.host="localhost"/>

</Context>




> Technically speaking, the connection hasn't been leaked, but the
> connection pool can't really guess the reason why the connection hasn't
> been returned.
>
> Can you time your queries to see how long they take? Could you post your
> <Resource> configuration for your DataSource?
>


For some queries it took more than 30 seconds, from getting data from
ip_to_geo table, which has 3 million rows in it.



> Another note: I notice that you are using a DataSource object that
> survives for the life of the DAO object, and is even created by the
> object in its constructor.


Every DAO has only one instance for the entire life of application. Is this
correct approach. So Every thread accessing the same datasource object to
get connection.

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