This discussion is archived
1 Reply Latest reply: Nov 24, 2012 4:08 PM by jschellSomeoneStoleMyAlias RSS

DB Connection Pool

507066 Newbie
Currently Being Moderated
After 1 month of Tomcat 6.0.18 running, I have 50 opened JDBC connections (some of them are 1 month old), which should be closed, but they aren't. All connections have first or second stack trace:

TP-Processor22
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.read(SocketInputStream.java:129)
java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
java.io.BufferedInputStream.read(BufferedInputStream.java:317)
org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:620)
org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:558)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:685)
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
java.lang.Thread.run(Thread.java:662)

TP-Processor29
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:485)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:662)
java.lang.Thread.run(Thread.java:662)

Those are my connection pool settings:

<Resource name="jdbc/myDS" auth="Container" type="oracle.jdbc.pool.OracleDataSource"
connectionCacheProperties="{InitialLimit=3, MinLimit=3, MaxLimit=100, AbandonedConnectionTimeout=900, InactivityTimeout=1800, PropertyCheckInterval=60, ValidateConnection=true}"
connectionCachingEnabled="true"
user="myuser" password="mypass" factory="oracle.jdbc.pool.OracleDataSourceFactory"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@someip:1521:myDB"
/>

What am I doing wrong? I am closing DB connections from my Java code, but even if I fail to close, it should be automatically closed after some period (timeout)?

Thank you in advance,
Milan
  • 1. Re: DB Connection Pool
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    I fail to close, it should be automatically closed after some period (timeout)?
    I doubt that. If you don't return it to the pool (close it in all paths) then it is your(caller) problem not the pools.
    What am I doing wrong?
    Probably failing to close it on all paths - for instance exceptions (finally blocks.) Or failing to close associated resources like statements/result sets.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points