Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-9397

Memory leak in EJB3.1 no interface view for stateful beans

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Done
    • Affects Version/s: 6.0.0.Final
    • Fix Version/s: 6.1.0
    • Component/s: EJB
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Create and remove stateful no-interface beans in a loop. On my machine it will not reach 23000 beans.

      Show
      Create and remove stateful no-interface beans in a loop. On my machine it will not reach 23000 beans.
    • Estimated Difficulty:
      Low

      Description

      Using a stateful no-interface bean causes a memory leak in PermGen space. This can easily be reproduced by creating and removing such a bean. On my machine it fails after 22500 instances.

      The problem is that for each instance of a bean a new Proxy-class is generated.

      This is done using javassist framework in the class org.jboss.ejb3.proxy.javassist.JavassistProxyFactory in method createProxy(Class[], InvocationHandler). Here the depreciated javassist method (instance).setHandler(...) is used. Due to documentation (http://www.csg.is.titech.ac.jp/~chiba/javassist/html/javassist/util/proxy/ProxyFactory.html) this call deactivates the cache!

      The solution is simply to remove that call and pass the handler right in the (instance).create(...) method.

        Attachments

          Activity

            People

            Assignee:
            jaikiran Jaikiran Pai (Inactive)
            Reporter:
            koras Jürgen Koras (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: