Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0F64EDDE8 for ; Thu, 16 Aug 2012 06:38:42 +0000 (UTC) Received: (qmail 94171 invoked by uid 500); 16 Aug 2012 06:38:42 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 93886 invoked by uid 500); 16 Aug 2012 06:38:39 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 93854 invoked by uid 99); 16 Aug 2012 06:38:38 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Aug 2012 06:38:38 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 114B52C5BE8 for ; Thu, 16 Aug 2012 06:38:38 +0000 (UTC) Date: Thu, 16 Aug 2012 17:38:38 +1100 (NCT) From: "Costin Leau (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <29498439.17822.1345099118071.JavaMail.jiratomcat@arcas> In-Reply-To: <1205435518.116104.1343657854639.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (HADOOP-8632) Configuration leaking class-loaders MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-8632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Costin Leau updated HADOOP-8632: -------------------------------- Attachment: HADOOP-8632-trunk.patch Attaching the patch against the trunk (the previous patch as mentioned, was against branch-2.1.0-alpha). Ran git diff --no-prefix 7a3427de68 518c39814e The github link is: http://j.mp/Nor44u Did a cherry pick of the commit against 2.1.0-alpha. > Configuration leaking class-loaders > ----------------------------------- > > Key: HADOOP-8632 > URL: https://issues.apache.org/jira/browse/HADOOP-8632 > Project: Hadoop Common > Issue Type: Bug > Components: conf > Affects Versions: 2.0.0-alpha > Reporter: Costin Leau > Attachments: 0001-wrapping-classes-with-WeakRefs-in-CLASS_CACHE.patch, HADOOP-8632.patch, HADOOP-8632-trunk.patch > > > The newly introduced CACHE_CLASSES leaks class loaders causing associated classes to not be reclaimed. > One solution is to remove the cache itself since each class loader implementation caches the classes it loads automatically and preventing an exception from being raised is just a micro-optimization that, as one can tell, causes bugs instead of improving anything. > In fact, I would argue in a highly-concurrent environment, the weakhashmap synchronization/lookup probably costs more then creating the exception itself. > Another is to prevent the leak from occurring, by inserting the loadedclass into the WeakHashMap wrapped in a WeakReference. Otherwise the class has a strong reference to its classloader (the key) meaning neither gets GC'ed. > And since the cache_class is static, even if the originating Configuration instance gets GC'ed, its classloader won't. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira