DO NOT REPLY [Bug 51687] New: Improve JreMemoryLeakPreventionListener against leak caused by sun.java2d.Disposer

2011-08-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51687

 Bug #: 51687
   Summary: Improve JreMemoryLeakPreventionListener against leak
caused by sun.java2d.Disposer
   Product: Tomcat 6
   Version: unspecified
  Platform: PC
OS/Version: Linux
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: m...@meep.pl
Classification: Unclassified


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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 51688] New: JreMemoryLeakPreventionListener should protect against AWT thread creation

2011-08-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51688

 Bug #: 51688
   Summary: JreMemoryLeakPreventionListener should protect against
AWT thread creation
   Product: Tomcat 7
   Version: trunk
  Platform: PC
Status: NEW
  Severity: enhancement
  Priority: P2
 Component: Catalina
AssignedTo: dev@tomcat.apache.org
ReportedBy: ch...@christopherschultz.net
Classification: Unclassified


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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1159673 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java webapps/docs/changelog.xml webapps/docs/config/listeners.xml

2011-08-19 Thread schultz
Author: schultz
Date: Fri Aug 19 16:23:44 2011
New Revision: 1159673

URL: http://svn.apache.org/viewvc?rev=1159673&view=rev
Log:
Fixed bug 51688: JreMemoryLeakPreventionListener should protect against AWT 
thread creation
- Added awtThreadProtection setting

Modified:

tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java?rev=1159673&r1=1159672&r2=1159673&view=diff
==
--- 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
 Fri Aug 19 16:23:44 2011
@@ -67,6 +67,18 @@ public class JreMemoryLeakPreventionList
 public void setAppContextProtection(boolean appContextProtection) {
 this.appContextProtection = appContextProtection;
 }
+
+/**
+ * Protect against the memory leak caused when the first call to
+ * java.awt.Toolkit.getDefaultToolkit() is triggered
+ * by a web application. Defaults to false because a new
+ * Thread is launched.
+ */
+private boolean awtThreadProtection = false;
+public boolean isAWTThreadProtection() { return awtThreadProtection; }
+public void setAWTThreadProtection(boolean awtThreadProtection) {
+  this.awtThreadProtection = awtThreadProtection;
+}
 
 /**
  * Protect against the memory leak caused when the first call to
@@ -218,6 +230,12 @@ public class JreMemoryLeakPreventionList
 if (appContextProtection) {
 ImageIO.getCacheDirectory();
 }
+
+// Trigger the creation of the AWT (AWT-Windows, AWT-XAWT,
+// etc.) thread
+if(awtThreadProtection) {
+  java.awt.Toolkit.getDefaultToolkit();
+}
 
 /*
  * Several components end up calling:

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1159673&r1=1159672&r2=1159673&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Aug 19 16:23:44 2011
@@ -89,6 +89,10 @@
 51658: Fix possible NPE when logging a failed request. Based
 on a suggestion by Felix Schumacher. (markt)
   
+  
+51688 JreMemoryLeakPreventionListener now protects against
+AWT thread creation. (schultz)
+  
 
   
   

Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml?rev=1159673&r1=1159672&r2=1159673&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml Fri Aug 19 16:23:44 
2011
@@ -173,6 +173,12 @@
 it is strongly recommended that this protection is enabled. The default
 is true.
   
+  
+Enables protection so that calls to
+java.awt.Toolkit.getDefaultToolkit() triggered by a web
+application do not result in a memory leak.
+Defaults to false because an AWT thread is launched.
+  
 
   
 The first use of java.sql.DriverManager will trigger 
the



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



svn commit: r1159674 - /tomcat/tc6.0.x/trunk/STATUS.txt

2011-08-19 Thread schultz
Author: schultz
Date: Fri Aug 19 16:26:07 2011
New Revision: 1159674

URL: http://svn.apache.org/viewvc?rev=1159674&view=rev
Log:
Back-port proposal

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=1159674&r1=1159673&r2=1159674&view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Fri Aug 19 16:26:07 2011
@@ -89,3 +89,10 @@ PATCHES PROPOSED TO BACKPORT:
   https://issues.apache.org/bugzilla/attachment.cgi?id=27318
   +1: markt
   -1:
+
+* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51688
+  JreMemoryLeakPreventionListener should protect against AWT thread creation
+  http://svn.apache.org/viewvc?view=revision&revision=1159673
+  +1: schultz
+  -1:
+



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 51688] JreMemoryLeakPreventionListener should protect against AWT thread creation

2011-08-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51688

Christopher Schultz  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED
 OS/Version||All

--- Comment #1 from 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.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1159673 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java webapps/docs/changelog.xml webapps/docs/config/listeners.xml

2011-08-19 Thread Konstantin Kolinko
2011/8/19  :
> +    private boolean awtThreadProtection = false;
> +    public boolean isAWTThreadProtection() { return awtThreadProtection; }
> +    public void setAWTThreadProtection(boolean awtThreadProtection) {
> +      this.awtThreadProtection = awtThreadProtection;
> +    }

> +      

Looking at the getter and setter methods, I think the actual name of
the property is "AWTThread...". I have not tried it though.

Wouldn't you forget to apply the same change to trunk (aka Tomcat 8)?

> +        Enables protection so that calls to
> +        java.awt.Toolkit.getDefaultToolkit() triggered by a web
> +        application do not result in a memory leak.
> +        Defaults to false because an AWT thread is launched.
> +      

Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1159673 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java webapps/docs/changelog.xml webapps/docs/config/listeners.xml

2011-08-19 Thread Christopher Schultz
Konstantin,

On 8/19/2011 12:34 PM, Konstantin Kolinko wrote:
> 2011/8/19  :
>> +private boolean awtThreadProtection = false;
>> +public boolean isAWTThreadProtection() { return awtThreadProtection; }
>> +public void setAWTThreadProtection(boolean awtThreadProtection) {
>> +  this.awtThreadProtection = awtThreadProtection;
>> +}
> 
>> +  
> 
> Looking at the getter and setter methods, I think the actual name of
> the property is "AWTThread...". I have not tried it though.

You're right. Stupid copy/paste.

> Wouldn't you forget to apply the same change to trunk (aka Tomcat 8)?

I wasn't sure what was up in the trunk... the changelog is completely
blank. This can't be the first commit to the trunk. Maybe there's no use
in updating the changelog before the first release?

-chris



signature.asc
Description: OpenPGP digital signature


svn commit: r1159680 - /tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml

2011-08-19 Thread schultz
Author: schultz
Date: Fri Aug 19 16:49:18 2011
New Revision: 1159680

URL: http://svn.apache.org/viewvc?rev=1159680&view=rev
Log:
Fixed capitalization of "AWT".

Modified:
tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml

Modified: tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml?rev=1159680&r1=1159679&r2=1159680&view=diff
==
--- tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/config/listeners.xml Fri Aug 19 16:49:18 
2011
@@ -173,7 +173,7 @@
 it is strongly recommended that this protection is enabled. The default
 is true.
   
-  
+  
 Enables protection so that calls to
 java.awt.Toolkit.getDefaultToolkit() triggered by a web
 application do not result in a memory leak.



-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



DO NOT REPLY [Bug 51687] Improve JreMemoryLeakPreventionListener against leak caused by sun.java2d.Disposer

2011-08-19 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=51687

--- Comment #1 from Christopher Schultz  
2011-08-19 16:51:54 UTC ---
Which daemon thread?

Is this the same as bug #51688?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: svn commit: r1159673 - in /tomcat/tc7.0.x/trunk: java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java webapps/docs/changelog.xml webapps/docs/config/listeners.xml

2011-08-19 Thread Konstantin Kolinko
2011/8/19 Christopher Schultz :
> Konstantin,
>
> On 8/19/2011 12:34 PM, Konstantin Kolinko wrote:
>> 2011/8/19  :
>>> +    private boolean awtThreadProtection = false;
>>> +    public boolean isAWTThreadProtection() { return awtThreadProtection; }
>>> +    public void setAWTThreadProtection(boolean awtThreadProtection) {
>>> +      this.awtThreadProtection = awtThreadProtection;
>>> +    }
>>
>>> +      
>>
>> Looking at the getter and setter methods, I think the actual name of
>> the property is "AWTThread...". I have not tried it though.
>
> You're right. Stupid copy/paste.
>
>> Wouldn't you forget to apply the same change to trunk (aka Tomcat 8)?
>
> I wasn't sure what was up in the trunk... the changelog is completely
> blank. This can't be the first commit to the trunk. Maybe there's no use
> in updating the changelog before the first release?
>

Mark cleared the changelog file after creating the branch.

The idea is that
* work is done on trunk
* it is merged to tc7.0.x
* items merged to tc7.0.x go into TC7's changelog file  and those that
won't be merged go into TC8's changelog.

There is a comment at the top of trunk's changelog.xml:
(...)
  Until the first Tomcat 8.0.0 release, only changes not back-ported to 7.0.x
  should be listed here.
 -->


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org