Bug 29497 - Connection pool, redeployment
Connection pool, redeployment
Status: RESOLVED DUPLICATE of bug 37262
Product: Tomcat 5
Classification: Unclassified
Component: Catalina
PC Windows XP
: P3 normal with 2 votes (vote)
: ---
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2004-06-10 14:11 UTC by dima
Modified: 2006-07-31 19:16 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description dima 2004-06-10 14:11:17 UTC
My application uses database for storing information, particularly mysql.

During it's work it takes 4 connections from the connection pool.
At this moment number number of physical connections to database increases by 4.
Then connection are being closed from inside the application.
Number of physical connections does not decrease. As I suspect these connections
are in pool.
When application takes those 4 connections again number of physical connections
stays the same, i.e. everything is ok.
But when I redeploy application connection pool does not release physical
connections, i.e. each time after application is being redeployed, number of
physical connections increases by 4 until I get exception: too many opened

This problem occurs with Tomcat 5.0.9 on WinXP with DBCP 1.1 / 1.2
and Tomcat 5.0.25 on FreeBSD. Mysql is run on FreeBSD
Comment 1 Albert Tumanov 2005-05-19 10:44:12 UTC
I have the same problem on Tomcat 5.0.28, WinXP and Oracle (different versions).

Steps to reproduce:
1) set up a datasource under some specific context, 
   setting parameter maxIdle to 1 or more
2) create an application (servlet) that uses the datasource to open (and close)
a connection
3) run the servlet once
4) check that there is a connection created 
   (e.g. by using Oracle query "select * from v$session")
5) reload the application (using Tomcat Manager or automatic reloading)
6) check that the connection is still open
   (e.g. by using Oracle query "select * from v$session")
7) run the servlet once
8) check that there is a NEW connection created 
   (e.g. by using Oracle query "select * from v$session")

Expected result: 
when reloading the application, the connection pool associated with its context
should be closed and all its connections also closed (step 6).

1) if on step 5 I restart Tomcat server instead of reloading one application,
the connection pool's connections are closed as expected
2) if I set maxIdle to 0 when configuring the datasource (step 1),
then connections are closed immediately when the application releases them.
This indicates that the application closes the used connections correctly.

See also:
Comment 2 VickyKak 2006-06-15 04:51:38 UTC
Can you guys test setting this 

in the Resource tag as explained here 

Comment 3 Mark Thomas 2006-08-01 02:16:09 UTC

*** This bug has been marked as a duplicate of 37262 ***