You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/11/24 10:50:21 UTC

DO NOT REPLY [Bug 41034] New: - Classloader leak caused by request recycle

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034

           Summary: Classloader leak caused by request recycle
           Product: Tomcat 5
           Version: 5.5.17
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: arnaud.brochard@kuehne-nagel.com


It seems that a classloader leak is caused by the re-use of a request object
when connecting to tomcat. Just after a connection attempt to my servlet and a
undeploy/redeploy procedure, my classloader won't go because of the reference
displayed below (collected with hat):

--> org.apache.catalina.connector.Request@0x500993fa (field filterChain:)
 --> org.apache.catalina.core.ApplicationFilterChain@0x500998b0 (field filters:)
  --> org.apache.catalina.core.ApplicationFilterConfig[]@0x500998c8
   --> org.apache.catalina.core.ApplicationFilterConfig@0x50090aaa (field context:)
    --> org.apache.catalina.core.StandardContext@0x5008104d (field loader:)
     --> org.jboss.web.tomcat.tc5.WebAppLoader@0x5007df2f (field parentClassLoader:)
      --> java.net.FactoryURLClassLoader@0x5007cd0f (field parent:)
       --> org.jboss.mx.loading.UnifiedClassLoader3@0x5003f4d0


Then I modified the recycle method of org.apache.catalina.connector.Request
while adding filterChain=null (which was missing) and my classloader was
correctly garbaged. I guess the filterChain variable must be nullified.

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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034





------- Additional Comments From remm@apache.org  2006-11-29 04:01 -------
The filters array holds mapped filters. The request objects are reused, so if on
a subsequent request you map as many filters as you did on the previous
invocation, the references in the filters array will be overwritten (the diff I
sent does the same).

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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034





------- Additional Comments From remm@apache.org  2006-11-28 18:20 -------
BTW, if you would like to clear those references on every request (to ensure
everything gets garbage collected as quickly as possible), you should be able to
clear the mapped filters like this:

Index: ApplicationFilterChain.java
===================================================================
--- ApplicationFilterChain.java	(revision 480297)
+++ ApplicationFilterChain.java	(working copy)
@@ -529,6 +529,9 @@
      */
     void release() {
 
+        for (int i = 0; i < n; i++) {
+            filters[i] = null;
+        }
         n = 0;
         pos = 0;
         servlet = null;


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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034


bstansberry@jboss.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bstansberry@jboss.com




------- Additional Comments From bstansberry@jboss.com  2007-01-11 12:46 -------
*** Bug 41324 has been marked as a duplicate of this bug. ***

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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034


remm@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From remm@apache.org  2006-11-24 03:33 -------
Cool workaround (-1 for it). The field will go away sooner or later, so it does
not really matter.

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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034





------- Additional Comments From bstansberry@jboss.com  2007-01-11 12:56 -------
(In reply to comment #4)

If on any subsequent request you don't map as many filters (i.e. the undeployed
app  used a lot of filters), the leak is permanent. An edge case, and not a huge
problem since if you redeploy the app most likely the new filters will replace
the old.

The biggest hassle about it is it makes it a pain to test for classloader leaks.
 But it's fixed in 6.x, so no big deal.



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

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


DO NOT REPLY [Bug 41034] - Classloader leak caused by request recycle

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41034>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41034





------- Additional Comments From arnaud.brochard@kuehne-nagel.com  2006-11-29 01:37 -------
Thanks for the tip.
The thing is I don't see the field nor the request object garbaged, like you
said earlier (even after days), but I can't reproduce this behavior with a
simple example. I guess something else is interfering in the application. 



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

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