Bug 39975

Summary: Classloader refence leaks in jasper-runtime when webapp has log4j and commons-logging
Product: Tomcat 5 Reporter: Taras Tielkes <taras.tielkes>
Component: JasperAssignee: Tomcat Developers Mailing List <dev>
Severity: normal    
Priority: P2    
Version: 5.0.17   
Target Milestone: ---   
Hardware: All   
OS: other   

Description Taras Tielkes 2006-07-06 08:44:19 UTC
When the first JSP renderd (since startup) is from a webapp that contains
commons-logging and log4j, classes from the 'jasper.runtime' package create a
memory leak.

Here's a description in more detail
1) User deploys war with commons-logging + log4j jars (quite common)
2) First page is rendered, causing loading and initialization of classes in the
'jasper.runtime' package.
3) Some of these classes (for instance PageContextImpl) contain static
commons-logging 'log' fields.
4) In the scenario described, these fields get intialized to a Log4JLogger
instance that is loaded from the webapp classloader.

The effective result is that code and data in this webapp will never be unloaded.
Comment 1 Yoav Shapira 2006-12-26 07:03:27 UTC
I see your point.  I've removed the static Log fields in favor of non-static
ones for Jasper in Tomcat 5.5 (should be in time for the 5.5.21 release).  I
guess this still needs to be done in 5.0.
Comment 2 Yoav Shapira 2006-12-26 07:25:43 UTC
Done for Tomcat 5.0 as well.