Bug 47987

Summary: Out of memory being caused by notFoundResources in org.apache.catalina.loader.WebappClassLoader
Product: Tomcat 5 Reporter: David <david>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: major    
Priority: P2    
Version: 5.5.28   
Target Milestone: ---   
Hardware: PC   
OS: Linux   

Description David 2009-10-12 15:02:07 UTC

Tomcat 6.0.20, java 1.6, linux x64

org.apache.catalina.loader.WebappClassLoader records every resource you asked
for that doesn't exist.

On our site we have alot of pages ( > 800,000 )
all of which are using struts2 with validation.
every hit means the validator does a request for a resource actionName-validation.xml

This then gets cached in the WebappClassLoader
about line 249

     * The list of not found resources.
    protected HashMap notFoundResources = new HashMap();

Can this be made into a weak hash map perchance ?

or something so that it won't invoke a out of memory.
I'm also looking at removing the validator from those urls
if anyone knows how to tell the validation interceptor that we don't use the xml files
and ONLY use annotations then that would be great :)


Comment 1 Mark Thomas 2009-10-21 13:58:47 UTC
This has been fixed in trunk and proposed for 6.0.x

I limited the cache to 1000 items.
Comment 2 Mark Thomas 2009-10-21 13:59:17 UTC
Re-opening until it is fixed in 6.0.x. Sorry for the noise
Comment 3 Mark Thomas 2009-11-02 15:43:06 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.

It still needs to be applied to 5.5.x.
Comment 4 Mark Thomas 2010-01-30 14:16:37 UTC
I have proposed porting the fix from 6.0.x to 5.5.x
Comment 5 Konstantin Kolinko 2010-03-03 17:15:26 UTC
Fixed in 5.5, will be in 5.5.29 onwards.