Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-2593

Memory leak in JBoss AS / Hibernate JPA integration

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Critical
    • No Release
    • No Release
    • JPA / Hibernate
    • None
    • Hide

      Unpack a distribution of 7.1.1 community or EAP 6.2 beta. No changes are required to the configuration.

      1. Deploy attached jmxp.ear.ear
      2. Send a request to the application so a query gets executed:
      curl http://localhost:8080/jmxp/jmxp
      Expected output:
      queries executed
      Class is class org.hibernate.stat.internal.ConcurrentStatisticsImpl
      3. Ask for queries:
      ./jboss-cli.sh --connect --command='/deployment=jmxp.ear.ear/subdeployment=jmxp.ejb.jar/subsystem=jpa/hibernate-persistence-unit=jmxp.ear.ear\/jmxp.ejb.jar#fraudPU:read-children-resources(child-type=query-cache)'

      First time the result is fine. On subsequent requests with jboss-cli.sh new elements will appear although no requests were issued to the application.

      After a number of request (for example from a monitoring system) an OutOfMemoryError will occur.

      Show
      Unpack a distribution of 7.1.1 community or EAP 6.2 beta. No changes are required to the configuration. 1. Deploy attached jmxp.ear.ear 2. Send a request to the application so a query gets executed: curl http://localhost:8080/jmxp/jmxp Expected output: queries executed Class is class org.hibernate.stat.internal.ConcurrentStatisticsImpl 3. Ask for queries: ./jboss-cli.sh --connect --command='/deployment=jmxp.ear.ear/subdeployment=jmxp.ejb.jar/subsystem=jpa/hibernate-persistence-unit=jmxp.ear.ear\/jmxp.ejb.jar#fraudPU:read-children-resources(child-type=query-cache)' First time the result is fine. On subsequent requests with jboss-cli.sh new elements will appear although no requests were issued to the application. After a number of request (for example from a monitoring system) an OutOfMemoryError will occur.
    • Workaround Exists
    • Hide

      Disable statistics in the persistence unit.

      Show
      Disable statistics in the persistence unit.

    Description

      The leak exists in AS integration code with Hibernate JPA.

      When a persistence unit is deployed which has 2nd level cache and statistics enabled each query for "query-cache" elements produces new elements.

      The issue lies in org.jboss.as.jpa.hibernate4.management.HibernateStatisticsResource. getQueryNames() method requests query names from Hibernate and applies QueryName.queryName(query).getDisplayName() to change names. Then for all queries hasQuery() is called which invokes stats.getQueryStatistics(). Within this method Hibernate creates a new object to track the statistics because the name is not found.

      Possible solution is to reverse the work done by getDisplayName() but I'm not sure if it's the right thing to do.

      This issue arised when we deployed jmxproxy application which was queried from Zabbix installation. For some MBean queries the implementation visits all MBeans deployed on the server. This kills the JVM after about 7 days.

      Attachments

        1. jmxp.ear.ear
          5 kB
        2. jmxp.tar.gz
          7 kB

        Activity

          People

            smarlow1@redhat.com Scott Marlow
            lklm_jira Michael Kozak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: