Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-8632

Configuration leaking class-loaders

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.0-alpha
    • 2.0.2-alpha
    • conf
    • None

    Description

      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.

      Attachments

        1. HADOOP-8632-trunk-no-tabs.patch
          4 kB
          Costin Leau
        2. HADOOP-8632-trunk.patch
          4 kB
          Costin Leau
        3. HADOOP-8632.patch
          4 kB
          Costin Leau
        4. 0001-wrapping-classes-with-WeakRefs-in-CLASS_CACHE.patch
          4 kB
          Costin Leau

        Issue Links

          Activity

            People

              costin.leau Costin Leau
              costin.leau Costin Leau
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: