Bug 43444 - Class loading problem
Summary: Class loading problem
Status: RESOLVED DUPLICATE of bug 29936
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.14
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-21 04:49 UTC by Daniel Spilker
Modified: 2008-04-25 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Spilker 2007-09-21 04:49:52 UTC
When deploying a webapp contain some TLDs and containing custom JAXP stuff, 
the web app is not completely removed when undeploying.

The problem is that org.apache.catalina.startup.TldConfig has a static member 
tldDigester which uses a SAXParser. In my case a parser from the web app is 
being used. So since the parser (its class is loaded with the 
WebAppClassLoader) will be referenced from the TldConfig class (which is 
loaded with the StandardClassLoader) the web app class loader never gets 
collected which leads to a full permspace after a few redeploys.

How to reproduce:
Create a WAR containing an empty web.xml and jstl-1.1.2.jar, standard-
1.1.2.jar (both from Jakarta Taglibs project), xercesImpl-2.9.0.jar and xml-
apis-2.9.0.jar (both from Xerces project). Run a tomcat containing just the 
manager web app. Deploy the WAR. Undeploy the WAR. Take a heap dump (e.g. 
using jmap). Analyse the dump (e.g. using jhat). Browse to the class of 
org.apache.catalina.startup.TldConfig. See that it is being loaded by the 
StandardClassLoader. Browse to the object pointed to by the tldDigester static 
member. Jump to the object pointed to by the parser instance member. In this 
example it is an org.apache.xerces.jaxp.SAXParserImpl. Jump the class of this 
object. See that it is being loaded by the WebAppClassLoader. This is why the 
WebAppClassloader will never be collected.

I am using JDK 1.6.0_02.
Comment 1 Daniel Spilker 2007-09-21 04:55:23 UTC
Sorry, but I can not attach the WAR described above since I can not compress 
it to be smaller than 1000kb.
Comment 2 Daniel Spilker 2007-09-21 05:19:26 UTC
An easy fix would be to make the tldDigester member in TldConfig not static. 
This would cost some extra cycles when deploying applications, but that would 
be OK for me if it fixes a memory leak.
Comment 3 Mark Thomas 2008-04-25 12:18:14 UTC

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