tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Mikusa <dmik...@pivotal.io>
Subject Re: Tomcat JDBC pool - too many connections in TIME_WAIT state
Date Wed, 05 Nov 2014 14:36:07 GMT
On Wed, Nov 5, 2014 at 9:13 AM, Vasily Kukhta <v.b.kukhta@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!
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message