tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Raible <MRai...@RESORTQUEST.com>
Subject RE: Datasource connections not released when reloading context
Date Fri, 03 Oct 2003 16:11:43 GMT
Actually, I was looking at the wrong count - it was the total number of
sessions.  So looking at the "right" number of connections - I only see it
increase by 1 each time - presumably because the JDBCRealm does not release
its connection when the context is stopped and started again.

Matt

-----Original Message-----
From: Matt Raible [mailto:MRaible@RESORTQUEST.com]
Sent: Friday, October 03, 2003 9:52 AM
To: 'Tomcat Users List'
Subject: RE: Datasource connections not released when reloading context


I tried changing the "removeAbandonedTimeout" to <value>1</value> and then
to test it was working - here's what I did.

1.  My app opens 2 connections to MySQL - one for the JDBCRealm and one for
the database connection pool.

2.  Logged into mysql to monitor the number of connections - it was intially
reported as 3 (1 for admin console, 2 for my app).

3.  Logged into Tomcat's Manager app, and stopped my application.  Database
connections = 3.

4.  Started my application.  Database connections = 5.

I did this a number of times and it increased by 2 each time - so obviously
this setting does not work on Tomcat 4.1.27/WinXP/JDK 1.4.2.

Thanks,

Matt

-----Original Message-----
From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com]
Sent: Friday, October 03, 2003 1:22 AM
To: Tomcat Users List
Subject: Re: Datasource connections not released when reloading context


Sorry, but I didn't see which datasource you were using. With DBCP, you 
have these optional parameters:

  <!--  abandoned dB connections are removed and recycled -->
  <parameter>
   <name>removeAbandoned</name>
   <value>true</value>
  </parameter>
  <!-- set the number of seconds a dB connection has been idle before
       it is considered abandoned. default timeout is 300 seconds.-->
  <parameter>
   <name>removeAbandonedTimeout</name>
   <value>60</value>
  </parameter>
  <!-- 'logAbandoned' can be set to true if you want DBCP to log a
       stack trace of the code which abandoned connections.-->
  <parameter>
   <name>logAbandoned</name>
   <value>true</value>
  </parameter>

I think if you set the timeout to 1 or 2, then you may see a stacktrace 
from abandoned connections.

I'd be interested to see if it works,
Adam


On 10/03/2003 12:30 AM Jose Alfonso Martinez wrote:
> On Wed, Oct 01, 2003 at 11:37:39AM -0500, Matt Raible wrote:
> 
>>I already do this, but when I "reload" my context, I get two database
>>connections, rather than one.  So each time I reload, I get an additional
>>connection - eventually resulting in an OutOfMemory Error (which I'm
>>attributing to this) after I reload 10-20 times.
>>
> 
> 
> That is what I was talking about. I have that problem. I close connections
after each access but when I reload my context I guess a new datasource is
created, therefore oppening new connections. After many reloads the database
max limit of connections is reached...
> 
> Does any one have an idea of what may be going on??? May be it could be
that I do not nullify the datasource in some destroy() method but I am not
sure...
> 
> Jose
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 

-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message