1 Reply Latest reply on Oct 25, 2016 11:40 AM by Tomaz Cerar

    WebInjectionContainer memory leak

    Damian Miranda Newbie

      After running a website using JBoss EAP 6.1.0.GA (AS 7.2.0.Final-redhat-8) for 6-7 hours and under heavy load our JVM runs out of memory.

       

      We took a heap dump and ran the memory leak detector tool that comes with Eclipse Memory Analyzer. This is the output:

       

      ------------------

       

      One instance of "org.jboss.as.web.deployment.WebInjectionContainer" loaded by "org.jboss.modules.ModuleClassLoader @ 0x690084600" occupies 645,798,152 (20.82%) bytes. The memory is accumulated in one instance of "org.jboss.as.web.deployment.ConcurrentReferenceHashMap$Segment[]" loaded by "org.jboss.modules.ModuleClassLoader @ 0x690084600".

       

      Keywords

      org.jboss.as.web.deployment.WebInjectionContainer

      org.jboss.as.web.deployment.ConcurrentReferenceHashMap$Segment[]

      org.jboss.modules.ModuleClassLoader @ 0x690084600

       

      ------------------

       

      Has someone experienced the same issue ? If so how did you solve it ?

       

      Setting the system property org.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS to false as the page below mentions seems not to be the solution:

       

      [JBWEB-242] Memory Leak in PerThreadTagHandlerPool - JBoss Issue Tracker

       

      Constants.INJECT_TAGS is false by default and if we set Constants.USE_INSTANCE_MANAGER_FOR_TAGS to be false the destroyInstance won't never be called.

       

      public void reuse(Tag handler)

      {

        PerThreadData ptd = (PerThreadData)this.perThread.get();

        if (ptd.current < ptd.handlers.length - 1)

          ptd.handlers[(++ptd.current)] = handler;

        else

          try {

            handler.release();

          } finally {

            if ((Constants.INJECT_TAGS) || (Constants.USE_INSTANCE_MANAGER_FOR_TAGS))

              try {

                this.instanceManager.destroyInstance(handler);

              }

              catch (Exception e)

              {

              }

          }

      }

       

      Any help will be appreciated.

       

      Thanks