On Nov 11, 2013, at 12:59 AM, Anu Prab <anupr...@gmail.com> wrote: > On Nov 7, 2013, at 11:58 PM, Anu Prab <anupr...@gmail.com> 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>" > >> What factory are you using? It's important to share. Without it we don't > 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 > org.apache.tomcat.jdbc.pool.ConnectionPool.getThreadDump(ConnectionPool.java:1065) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:707) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:634) > at > org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
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 > > -Anu --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org