Bug 51688 - JreMemoryLeakPreventionListener should protect against AWT thread creation
Summary: JreMemoryLeakPreventionListener should protect against AWT thread creation
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2011-08-19 14:49 UTC by Christopher Schultz
Modified: 2011-08-25 13:39 UTC (History)
0 users


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