Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1164

ThreadLocal<Random> anonymous subclass prevents classloader from being garbage collected

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.12.4, 3.0.0
    • 2.12.0
    • Cluster Management
    • None
    • Fully Compatible

    Description

      Quoting from Stefan's comment:

      The problem is how BaseCluster.random is initialized to a ThreadLocal subclass instance. That class references the webapp's classloader. The ThreadLocal subclass in turn is referenced by each Thread instance (that's how ThreadLocals are implemented, they have a "helper-Map" in each Thread instance, so the leak is actually not a tiny Random instance but the whole webapp's classloader with a bunch of class definitions and statically referenced parts of the webapp

      Attachments

        Activity

          People

            jeff.yemin@mongodb.com Jeffrey Yemin
            jkemnade Jochen Kemnade
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: