tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hermes Flying <flyingher...@yahoo.com>
Subject Re: Discrepancy between Tomcat's connection pool and tomcat's report on memory leaks
Date Wed, 04 Apr 2012 12:54:29 GMT
Hi Pid,

This is the configuration
The following entry is in server.xml 

 <Resource name="jdbc_GENERIS_RS" auth="Container"
              type="javax.sql.DataSource"
              driverClassName="org.h2.Driver"
              url="jdbc:h2:file:/opt/en/repos/tomcat/webapps/GeneralApplication/db/internaldatabase;SCHEMA=genericschema"
              username="root" password="sa"
              maxActive="20" maxIdle="10" maxWait="-1"
              />


And the following entry is under $TOMCAT_HOME/conf/context.xml

 <ResourceLink name="jdbc/GenericDataSource"
                global="jdbc_GENERIS_RS"
                type="javax.sql.DataSource"/>

Concerning your other questions:
1) Yes I could shut down the database manually but I would like to do it as a last resort
if this issue is something that can not be fixed since I believe that my setup is correct
and should be supported as is

2) You say that it depends if I should close down the connection myself. But how can I do
that? A javax.sql.DataSource does not provide a close method. I would have to cast to org.apache.tomcat.dbcp.dbcp.BasicDataSource
to call close. I am not sure if this is the proper approach. I mean I then get bind to this
class, right? Or there is another way?

Thank you



________________________________
 From: Pid <pid@pidster.com>
To: Tomcat Users List <users@tomcat.apache.org> 
Sent: Wednesday, April 4, 2012 3:43 PM
Subject: Re: Discrepancy between Tomcat's connection pool and tomcat's report on memory leaks
 
On 04/04/2012 13:05, Hermes Flying wrote:
> Hi,
> 
> I am using Tomcat 7.0.25 in a Linux machine
> 
> I am using Tomcat's connection pool (org.apache.tomcat.dbcp.dbcp.BasicDataSource). As
database I am using H2 as a file database.
> All is ok, but I have the following problem.
> On shutdown of Tomcat I see in catalina.out: 

In which file have you defined the pool?


> SEVERE: The web application [/GeneralApplication] appears to have started a thread named
[H2 Log Writer GENERICAPPLICATION] but has failed to stop it. This is very likely to create
a memory leak.
> Apr 4, 2012 2:32:54 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
> SEVERE: The web application [/GeneralApplication] appears to have started a thread named
[H2 File Lock Watchdog /opt/en/repos/tomcat/webapps/GeneralApplication/db/internaldatabase.lock.db]
but has failed to stop it. This is very likely to create a memory leak.
> 
> Why do I get these messages?

When the application shuts down Tomcat tries to detect & prevent memory
leaks by examining threads & various things associated with the
WebappClassloader.


> As I understand these messages, H2 is still running on shutdown and the documentation
they have says that the database will shutdown once the last connection is closed (and the
connections are handled by the pool i.e. Tomcat)

So there is no way to manually the database down?


> Additionally the input from H2 dev is that these messages are a Tomcat problem. Tomcat
should have first disposed of the connection pool and then log the running threads.Their explanation
seem correct to me.

That's the usual first response.  Let's figure out whether it's correct...


> Is this a known issue? 

Not that I've come across here.

> Why do I see these errors in catalina? 

As above.

> Should I somehow dispose off the connection pool myself?

Depends.


p

> Thank you for your time
> Best Regards,
> FH
> 


-- 

[key:62590808]
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message