Bug 39975 - Classloader refence leaks in jasper-runtime when webapp has log4j and commons-logging
Summary: Classloader refence leaks in jasper-runtime when webapp has log4j and commons...
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.17
Hardware: All other
: P2 normal with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2006-07-06 08:44 UTC by Taras Tielkes
Modified: 2006-12-26 07:25 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
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.