hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gopal V (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HADOOP-10513) ReflectionUtils::CONSTRUCTOR_CACHE leaks class loaders
Date Wed, 16 Apr 2014 21:16:16 GMT
Gopal V created HADOOP-10513:

             Summary: ReflectionUtils::CONSTRUCTOR_CACHE leaks class loaders
                 Key: HADOOP-10513
                 URL: https://issues.apache.org/jira/browse/HADOOP-10513
             Project: Hadoop Common
          Issue Type: Bug
          Components: util
    Affects Versions: 2.4.0
            Reporter: Gopal V

Any code which uses custom class-loaders needs to be aware of the ReflectionUtils::CONSTRUCTOR_CACHE

   * Cache of constructors for each class. Pins the classes so they
   * can't be garbage collected until ReflectionUtils can be collected.
  private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE =

    new ConcurrentHashMap<Class<?>, Constructor<?>>();

This is not a problem when using only 1 AppClassLoader.

But in cases where the application uses multiple classloaders (to isolate UDFs), this holds
onto class references and their associated class loaders by ref (& that leaks all the

The clear method for this cache is unfortunately marked only for testing.

  // methods to support testing
  static void clearCache() {

The cache shows up as the only reference for the class loaders.


This message was sent by Atlassian JIRA

View raw message