https://issues.apache.org/bugzilla/show_bug.cgi?id=54217
Bug ID: 54217
Summary: JDBC connection pool runs out of connections when
Context reload=“true” is enabled in Tomcat
Product: Tomcat 7
Version: 7.0.32
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Created attachment 29646
--> https://issues.apache.org/bugzilla/attachment.cgi?id=29646&action=edit
Exception stack trace
I am developing a Java EE web application in Eclipse Juno. I have configured
Tomcat to use JDBC connection pool (org.apache.tomcat.jdbc.pool) along with
PostgreSQL database. Here are the configurations in my project's
META-INF/context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- Configuration for the Tomcat JDBC Connection Pool -->
<Resource name="jdbc/someDB"
type="javax.sql.DataSource"
auth="Container"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/somedb"
username="postgres"
password="12345"
maxActive="100"
minIdle="10"
initialSize="10"
validatonQuery="SELECT 1"
validationInterval="30000"
removeAbandoned="true"
removeAbandonedTimeout="60"
abandonWhenPercentageFull="50" />
</Context>
My application is deployed to Tomcat using Eclipse, and in Tomcat's context.xml
an attribute reloadable is set to "true" to automatically reload the web
application if a change is detected:
<Context reloadable="true">
I have noticed that every time the above mentioned automatic reload is
happening 10 more connections to PostgreSQL db is reserved (because in webapp's
context.xml initialSize="10"). So after 10 changes a PSQLException is thrown:
org.postgresql.util.PSQLException: FATAL: sorry, too many clients already
...
(full stack in attachment)
If I manually restart Tomcat - everything is fine and just 10 connections are
reserved. And I am closing all ResultSets, Statements/PrepareStatements,
Connections in the finally block.
Would be great if this issue could be fixed, so that it could be possible to
develop with reloadable set to "true" and not cause pooling more connections
every time the context is reloaded.
P.S.
Apache Tomcat 7.0.32
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Eclipse Juno Service Release 1
PostgreSQL version 9.1
DB driver: postgresql-9.1-902.jdbc4.jar
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]