Bug 51688

Summary: JreMemoryLeakPreventionListener should protect against AWT thread creation
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   

Description Christopher Schultz 2011-08-19 14:49:17 UTC
Any webapp that calls java.awt.Toolkit.getDefaultToolkit will launch a new thread (AWT-Windows, AWT-XAWT, etc.) which will capture the ContextClassLoader, pinning the webapp in memory after an undeploy/redeploy.

A simple addition to JreMemoryLeakPreventionListener can alleviate this condition.
Comment 1 Christopher Schultz 2011-08-19 16:27:21 UTC
Fixed in 7.0.x, will be included in 7.0.21.

Proposed for 6.0.x.
Comment 2 Sylvain Laurent 2011-08-22 19:05:07 UTC
Did you try to run this in a headless environment ?
And what about environments without a X library installed ?
Comment 3 Christopher Schultz 2011-08-22 22:00:49 UTC
I believe my environment is headless, though I didn't actually run with java.awt.headless=true, here. I'll check to see what happens when I do that.

I don't believe you can do any AWT work without an X environment under *NIX.

In any case, this is an optional setting that one would only use if they were going to be using AWT, so I don't believe there is any danger, here.

If you observe any specific problems, don't hesitate to re-open.
Comment 4 Christopher Schultz 2011-08-25 13:39:54 UTC
Fixed in 6.0.x, will be included in 6.0.34.

Fixed in 8.0.x (thanks to kkolinko).