0% found this document useful (0 votes)
610 views3 pages

Best Way To Track Down Connection Leak (JDBC Forum at JavaRanch)

java

Uploaded by

Azoth80
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
610 views3 pages

Best Way To Track Down Connection Leak (JDBC Forum at JavaRanch)

java

Uploaded by

Azoth80
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Best way to track down connection leak (JDBC forum at JavaRanch)

http://www.coderanch.com/t/558843/JDBC/databases/Best-way-track...

File APIs for Java Developers Manipulate DOC, XLS, PPT, PDF and many others from your application. http://aspose.com/file-tools

A friendly place for programming greenhorns!

Search

Java FAQ | Recent Topics Register / Login

Win a copy of Think Python this week in the Jython/Python forum!

JavaRanch Java Forums Databases JDBC

Author

Justin Carter Greenhorn Joined: Jan 13, 2010 Posts: 9

posted mercoled 16 novembre 2011 00:50:26

We recently upgraded our connection pool manager to the version that is provided in Tomcat 6 (DBCP). However, we are plagued with an issue where the connection pool reaches its maxActive limit and then fails to release those connections back to the pool. (We do have removeAbandoned="true" and the removeAbandonedTimeout="30"). Eventually all of our web pages stall, and we have to restart Tomcat. We tried setting a maxWait value, but instead of a loading stall we get a lot of "pool error Timeout" exceptions and broken web pages. This issue also occurred in our previous connection pool before DBCP, so it seems like a problem that occurs no matter which connection pool implementation we use. The problem happens randomly; once or twice every couple of days. We have periods where this isn't an issue for weeks, and then times when we have to restart Tomcat a few times in one day. I'm at a loss on how to track this down. We have turned on the stacktrace logging and fixed every abandoned connection found, but the issue still remains. I have even adding custom logging that will print a stacktrace whenever the connection pool reaches a new maximum size, but I wasn't able to determine anything from that. I also occasionally dig through the access logs during these episodes, but it feels like trying to find a needle in a haystack; also, all the page hits seem to be to pages that handle their connections properly. So my questions are: 1) Could this some sort of thread-lock issue?

1 di 3

19/10/2012 17:17

Best way to track down connection leak (JDBC forum at JavaRanch)

http://www.coderanch.com/t/558843/JDBC/databases/Best-way-track...

2) Any recommendations for pinpointing the problem? 3) Should we switch to yet a different connection pool manager (new tomcat-jdbc, c3p0, etc.)? Here is my JNDI config: <Resource name="jdbc/..." auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:..." username="..." password="..." maxActive="50" maxIdle="30" minIdle="15" initialSize="15" removeAbandoned="true" removeAbandonedTimeout="30" maxWait="-1"/>
MarK sujoKi Greenhorn Joined: Sep 11, 2012 Posts: 1

posted mercoled 12 settembre 2012 01:53:23

Please go through below page, it might help http://commons.apache.org/dbcp/configuration.html Summary: If you have enabled "removeAbandoned" then it is possible that a connection is reclaimed by the pool because it is considered to be abandoned. This mechanism is triggered when (getNumIdle() < 2) and (getNumActive() > getMaxActive() - 3) For example maxActive=20 and 18 active connections and 1 idle connection would trigger the "removeAbandoned". But only the active connections that aren't used for more then "removeAbandonedTimeout" seconds are removed, default (300 sec). Traversing a resultset doesn't count as being used. @Justin, Please let me know, if you had figured out what the problem was in your case and the solution you implemented, if any. thanks in advance!

Wendy Gibbons Bartender Joined: Oct 21, 2008 Posts: 1064


I like...

posted mercoled 12 settembre 2012 11:53:45

I would go through your code checking you are closing all your statements and all of that stuff. And ensure they are all done in finally blocks in case of exceptions. (as you were getting problems before this change)

2 di 3

19/10/2012 17:17

Best way to track down connection leak (JDBC forum at JavaRanch)

http://www.coderanch.com/t/558843/JDBC/databases/Best-way-track...

okay, here's the link: jprofiler

subject: Best way to track down connection leak

Threads others viewed DBCP connection pooling with multiple web-apps Application hosted on Tomcat has datasource DBCP issues database connection pooling (dbcp) - help required Optimal JDBC connection pooling configuration for tomcat server DBCP issue - Timeout waiting for idle object
All times above are in your local time zone & format.The current ranch time (not your local time) is Oct 19, 2012 08:50:06.

Contact Us | Powered by JForum |

Copyright 1998-2012 Paul Wheaton

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care light bulbs flea control missoula electric heaters permaculture

3 di 3

19/10/2012 17:17

You might also like