On Wed, Nov 5, 2014 at 9:13 AM, Vasily Kukhta <v.b.kuk...@gmail.com> wrote:
> Hello all! > > I have developed an application using Tomcat JDBC pool. Everything is fine > except that the pool leaves hundreds of TCP connections in TIME_WAIT state, > I have to ask, but are you sure it's the pool? TCP connections in the TIME_WAIT state would indicate that a connection was closed. Given that the job of the pool is to keep the connections open and reuse them, it just seems a little odd. > which kills the server sooner or later... Could you please suggest what to > fix, my configuration is below: > > PoolProperties pp = new PoolProperties(); > > String connprops = > > "oracle.net.CONNECT_TIMEOUT=3000;oracle.jdbc.ReadTimeout=3000;oracle.net.READ_TIMEOUT=3000"; > > pp.setUsername(user); > pp.setPassword(pass); > pp.setConnectionProperties(connprops); > > pp.setDriverClassName("oracle.jdbc.OracleDriver"); > > pp.setTestOnBorrow(true); > pp.setTestOnConnect(true); > > pp.setTestWhileIdle(true); > > pp.setMaxWait(1000); > pp.setMinEvictableIdleTimeMillis(10000); > pp.setTimeBetweenEvictionRunsMillis(5000); > > pp.setValidationInterval(10000); > pp.setValidationQuery("SELECT 1 FROM DUAL"); > > pp.setRemoveAbandoned(true); > pp.setRemoveAbandonedTimeout(5); > > > pp.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.QueryTimeoutInterceptor(queryTimeout=3)"); > dataSource = new DataSource(); > dataSource.setPoolProperties(pp); > Nothing is jumping out at me as incorrect. Maybe try without the connection properties (i.e. the driver level timeouts)? Maybe try increasing the log level for "org.apache.tomcat.jdbc.pool" to FINEST or DEBUG. That might generate some additional logging to show why the connections are being closed. Also, check that your server is not timing out the connection, perhaps due to a server side limit. I've see this happen a lot. Although it seems unlikely, it's probably also worth checking that there's no firewall or network device that could be closing the connections. Dan > Thank you in advance! >