[
https://issues.apache.org/jira/browse/HADOOP-8632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435253#comment-13435253
]
Robert Joseph Evans commented on HADOOP-8632:
---------------------------------------------
When I try to apply the patch to trunk I get
{noformat}
$ patch -p 0 < HADOOP-8632.patch
patching file
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java
Hunk #3 succeeded at 1532 (offset 55 lines).
patching file
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
Hunk #2 FAILED at 1044.
1 out of 2 hunks FAILED -- saving rejects to file
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java.rej
{noformat}
You may want to try upmerging the patch to trunk.
> 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
>
>
> 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