tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: DBCP abandoned trace - unable to understand the leak
Date Thu, 04 Nov 2010 15:40:08 GMT
-----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.

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?

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. I usually recommend that your code obtain the
DataSource from the JNDI context each time it needs it to improve
flexibility. You could also use dependency injection if that it your
preferred mechanism for obtaining (or being provided with) a DataSource.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzS09gACgkQ9CaO5/Lv0PCxQACdFcCek6dGip51q06YtaY6tJSF
PT8An32Xxfy+d63TkjEs5tPr8a+KT0BZ
=4smp
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message