Bug 51687

Summary: Improve JreMemoryLeakPreventionListener against leak caused by sun.java2d.Disposer
Product: Tomcat 6 Reporter: Michał Politowski <mpol>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: PC   
OS: Linux   

Description Michał Politowski 2011-08-19 14:41:36 UTC
The sun.java2d.Disposer class, when loaded, starts an endless daemon thread that can inherit the WebappClassLoader as its context loader. This will cause a leak when the webapp is unloaded.

It would be useful if JreMemoryLeakPreventionListener could load this class to prevent the leak.
Comment 1 Christopher Schultz 2011-08-19 16:51:54 UTC
Which daemon thread?

Is this the same as bug #51688?
Comment 2 Michał Politowski 2011-08-22 08:44:15 UTC
I do not think so. It is a thread named "Java2D Disposer", created in the static initializer of the sun.java2d.Disposer class.
Comment 3 Christopher Schultz 2011-08-22 13:50:27 UTC
Can you post minimal code to cause this thread to be created?

I've just added a fix for that other, somewhat related, bug and I'd be happy to add this as well.
Comment 4 Michał Politowski 2011-08-22 14:12:16 UTC
The exact code that causes it in the webapp at hand is a
sun.java2d.Disposer.getQueue() call
somewhere in the standard JRE library,
but actually just anything that loads the class, even Class.forName("sun.java2d.Disposer"), is enough.
Comment 5 Christopher Schultz 2011-09-20 20:18:41 UTC
Fixed in trunk, 7.0.x branch. Will be included in 7.0.22 onward.