Bug 50222

Summary: JreMemoryLeakPreventionListener should speculatively cause memory leaks using the system ClassLoader
Product: Tomcat 7 Reporter: Christopher Schultz <chris>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Patch to add tccl push/pop around speculative ClassLoader pinning.

Description Christopher Schultz 2010-11-05 11:00:08 UTC
JreMemoryLeakPreventionListener intentionally invokes methods known to pin the context ClassLoader in memory in order to avoid having a WebappClassLoader unintentionally pin itself. This may cause undesirable behavior in embedded environments.

Instead, JMLPL could use a security context to temporarily set the current context ClassLoader to be the system ClassLoader and solve the embedded situation without the client having to remember to take this care.
Comment 1 Christopher Schultz 2010-11-05 13:54:37 UTC
Created attachment 26260 [details]
Patch to add tccl push/pop around speculative ClassLoader pinning.

Patch to add tccl push/pop around speculative ClassLoader pinning.

Patch does not include /lots/ of re-indentation required by a newly-added try/catch block surrounding everything.
Comment 2 Mark Thomas 2010-11-10 08:04:11 UTC
Nice idea and thanks for the patch.

It has been applied to 7.0.x and will be included in 7.0.5 onwards.
Comment 3 Mark Thomas 2010-11-25 12:19:38 UTC
Fixed in 6.0.x and will be included in 6.0.30 onwards.