glassfish
  1. glassfish
  2. GLASSFISH-14803

Permgen leak: GFFileHandler.recentErrors holds on a strong reference to WebappClassLoader preventing GC

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.1
    • Fix Version/s: 3.1_ms07
    • Component/s: logging
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      14,803

      Description

      While debugging perm-gen issues with an application that uses EJB3.1 singleton
      and JPA, it was found that GFFileHandler.recentErrors holds on
      to the last four LogRecords. If one of the LogRecords was a result of a
      application-defined Throwable/Exceptionm, the LogRecord holds a reference to the
      application-defined Exception class and the Exception class inturn hold on to
      their defining
      classloader (WebappClassLoader) preventing them from GC'ed, eventually resulting
      in a PermGen space issue.

      To reproduce the issue:

      • deploy and undeploy the app referred to in issue 12368
        https://glassfish.dev.java.net/issues/show_bug.cgi?id=12368
      • Perform a GC and analyze the heap using a tool like Eclipse Memory Analzer,
        the path from the WebappClassLoader (of the app that has been undeployed) to a
        GC root. [see attached image for the relevant Eclipse Memory Analyzer tool
        output where a HibernateException, that is part of the Hibernate library bundled
        wiht the application, is held on to by the GFFileHandler.recentErrors Queue].

      Please remove caching of the LogRecords or prevent holding of a strong reference
      to a user defined class.

        Activity

        Sivakumar Thyagarajan created issue -
        Hide
        Sivakumar Thyagarajan added a comment -

        Created an attachment (id=5538)
        Eclipse MAT output showing the leak

        Show
        Sivakumar Thyagarajan added a comment - Created an attachment (id=5538) Eclipse MAT output showing the leak
        kenaiadmin made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 14803 46407
        Hide
        naman_mehta added a comment -

        Made changes in the code to remove usage of recentErrors as it is not needed now.

        Show
        naman_mehta added a comment - Made changes in the code to remove usage of recentErrors as it is not needed now.
        naman_mehta made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 3.1_ms07 [ 11016 ]
        Fix Version/s not determined [ 11149 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            naman_mehta
            Reporter:
            Sivakumar Thyagarajan
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: