Hi guys,

When running a performance test on my system it starts fine, but after a
while I start getting errors in my application log such as (see the bottom
for full stack trace):

2013-03-29 16:38:54,778 ERROR
[org.hibernate.engine.jdbc.spi.SqlExceptionHelper] -
[SimpleAsyncTaskExecutor-12842] - [SimpleAsyncTaskExecutor-12842] Timeout:
Pool empty. Unable to fetch a connection in 30 seconds, none
available[size:80; busy:0; idle:0; lastwait:30000].

Questions:

1.) I'm a little confused about what it means if no connections are
available and yet none are "busy" nor "idle".  What are the other available
states?

2.) My other point of confusion is that assuming there is a connection leak
in the application, shouldn't  setting removeAbandoned=true cause the DB
connections to eventually be recovered? What I am seeing is that even after
a couple days of no application usage now I'm still getting that exact
error seen above when trying to use the application.

Thanks in advance.

----------------------------------------

environment:
Tomcat 7.0.32
RedHat Linux 64 bit
Java 7

context.xml:

<Resource name="fdatasource"
auth="Container"
type="javax.sql.DataSource"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
testWhileIdle="true"
testOnBorrow="true"
testOnReturn="true"
validationQuery="select 1 from dual"
validationInterval="30000"
timeBetweenEvictionRunsMillis="5000"
maxActive="80"
minIdle="10"
maxWait="30000"
initialSize="10"
removeAbandonedTimeout="1200"
removeAbandoned="true"
logAbandoned="true"
minEvictableIdleTimeMillis="60000"
jmxEnabled="false"
jdbcInterceptors="StatementFinalizer"
username="${db.user}"
password="${db.pw}"
driverClassName="oracle.jdbc.OracleDriver"
url="${db.url}" />

example stacktrace:

Mar 29, 2013 5:13:34 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [dispatcher] in context with path
[/app] threw exception [Request processing failed; nested exception is
org.springframework.transaction.CannotCreateTransactionException: Could not
open Hibernate Session for transaction; nested exception is
org.hibernate.exception.GenericJDBCException: Could not open connection]
with root cause
org.apache.tomcat.jdbc.pool.PoolExhaustedException:
[http-apr-8443-exec-158] Timeout: Pool empty. Unable to fetch a connection
in 30 seconds, none available[size:84; busy:0; idle:0; lastwait:30000].
at
org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:675)
at
org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
at
org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
at
org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at
org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:292)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
at
org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.getConnection(LogicalConnectionImpl.java:169)
at
org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doBegin(JdbcTransaction.java:67)
at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:160)
at
org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1395)
at
org.springframework.orm.hibernate4.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:387)

Reply via email to