Bug 49230 - sun.net.www.http.KeepAliveCache preventing classloader from being garbage collected
sun.net.www.http.KeepAliveCache preventing classloader from being garbage col...
Status: RESOLVED FIXED
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
unspecified
PC All
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-04-29 12:17 UTC by Rob Kooper
Modified: 2014-02-17 13:53 UTC (History)
0 users



Attachments
patch to jreMemoryLeakPreventionListener to load sun.net.www.http.KeepAliveCache using system classloader (1.79 KB, application/octet-stream)
2010-04-29 12:17 UTC, Rob Kooper
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Kooper 2010-04-29 12:17:59 UTC
Created attachment 25377 [details]
patch to jreMemoryLeakPreventionListener to load sun.net.www.http.KeepAliveCache using system classloader

When a servlet creates a URLConnection, internally this is done using sun.net.www.http.HttpClient. To have the ability to keep connections alive and close them after a certain time they are placed inside a cache. A static reference is kept to this cache (sun.net.www.http.KeepAliveCache).

It seems this cache is never released and the classloader stays in memory.

I have a patch to jreMemoryLeakPreventionListener.java that will make sure the KeepAliveCache is loaded by the system classloader and not the webAppClassLoader.
Comment 1 Mark Thomas 2010-06-22 05:25:02 UTC
Thanks for the patch. It has been applied to 7.0.x and will be included in 7.0.1 onwards.

I have also proposed the patch for back-port to  to 6.0.x
Comment 2 Sylvain Laurent 2010-06-22 15:36:52 UTC
IMHO, logging an error if the class is not found might induce some users of non-Sun JVMs in error...

an INFO level is probably enough, with a message explaining that it might be normal with some JVMs.
Comment 3 Mark Thomas 2010-06-23 03:44:14 UTC
I've aligned the patch with how we handle other Sun specific issues for non-Sun JVMs.
Comment 4 Mark Thomas 2010-06-26 04:29:39 UTC
This has been fixed in 6.0.x and will be included in 6.0.28 onwards.