Return-Path: X-Original-To: apmail-tomcat-dev-archive@www.apache.org Delivered-To: apmail-tomcat-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C2CE5DC1A for ; Mon, 1 Oct 2012 08:16:18 +0000 (UTC) Received: (qmail 25222 invoked by uid 500); 1 Oct 2012 08:02:48 -0000 Delivered-To: apmail-tomcat-dev-archive@tomcat.apache.org Received: (qmail 24798 invoked by uid 500); 1 Oct 2012 08:02:48 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 24750 invoked by uid 99); 1 Oct 2012 08:02:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 08:02:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Oct 2012 08:02:45 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id D46D5A657; Mon, 1 Oct 2012 08:02:24 +0000 (UTC) From: bugzilla@apache.org To: dev@tomcat.apache.org Subject: [Bug 53935] New: Minimize classloader leaks from stacktrace elements in long-lived Exceptions Date: Mon, 01 Oct 2012 08:02:24 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Tomcat 7 X-Bugzilla-Component: Catalina X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: markt@apache.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@tomcat.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: priority bug_id assigned_to short_desc bug_severity classification op_sys reporter rep_platform bug_status version component product resolution Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=53935 Priority: P2 Bug ID: 53935 Assignee: dev@tomcat.apache.org Summary: Minimize classloader leaks from stacktrace elements in long-lived Exceptions Severity: enhancement Classification: Unclassified OS: Windows NT Reporter: timo.kinnunen@gmail.com Hardware: PC Status: RESOLVED Version: unspecified Component: Catalina Product: Tomcat 7 Status: RESOLVED Resolution: DUPLICATE MemoryLeakProtection in the Tomcat wiki says: "Sun bug 6916498 - An exception can keep a classloader in memory if the stack trace that was recorded when it was created contains a reference to one of its classes." This bug may be considered an acceptable performance tradeoff, so detection and mitigation in the meantime is in my opinion desirable. The leak is caused by a reference cycle that is only partially visible to the garbage collector. The method fillInStackTrace() can be called on an Exception object to alter its stacktrace, but to effectively break the cycle the method call chain up to that point must be clean of any classes that shouldn't be retained. The attached test code contains two versions of the algorithm, for Java 1.6 and 1.7. The 1.6 version is intended to be effective only when loaded by a shared classloader, the 1.7 version should be effective even if loaded by a webapp classloader. The methods are intended to be called before or during webapp unloading/reloading on Exception objects stored in static variables. Please review to see if I've made any mistakes and consider for enhancement :) --- Comment #1 from Mark Thomas --- *** This bug has been marked as a duplicate of bug 53936 *** -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org