8 Replies Latest reply on Oct 30, 2012 10:24 AM by Michael Gronau

    Infinite loop on PassivatingBackingCacheImpl.get() causing memory leak

    guinotphil Apprentice



      I recently noticed a memory leak on a running standalone instance of AS 7.1.1.Final. After some investigations, it’s actually a lot of sessions which are not garbage collected.

      And the reason why they aren’t is actually because the ContainerBackgroundProcessor thread is getting stuck into the PassivatingBackingCacheImpl.get() method.


      Indeed, when the session is getting destroyed, it is calling the destruction of a Seam 2.2.2.Final component, which is also a Stateful EJB.


      Then, the PassivatingBackingCacheImpl.get() method is called and try to get the entity from the SimpleBackingCacheEntryStore’s cache, but for some reason it has been invalidated. So, the code loops until it gets a null object, which never happens.


      I don’t really understand how I get an invalided object in the cache, since the invalidation is being called during passivation. And the passivate() method of org.jboss.as.ejb3.cache.impl.backing.SimpleBackingCacheEntryStore calls the removal of the entity from the cache. So I have no idea how I get stuck in such a case. Also, I’m not really sure about how/when my bean get passivated…



      Here is my configuration by the way:


          <subsystem xmlns="urn:jboss:domain:ejb3:1.2">



                          <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>


                      <stateful default-access-timeout="5000" cache-ref="passivating"/>

                      <singleton default-access-timeout="5000"/>



                      <resource-adapter-ref resource-adapter-name="hornetq-ra"/>

                      <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>




                          <strict-max-pool name="slsb-strict-max-pool" max-pool-size="100" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                          <strict-max-pool name="mdb-strict-max-pool" max-pool-size="100" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>




                      <cache name="simple" aliases="NoPassivationCache"/>

                      <cache name="passivating" passivation-store-ref="file" aliases="SimpleStatefulCache"/>



                      <file-passivation-store name="file"/>


                  <async thread-pool-name="default"/>

                  <timer-service thread-pool-name="default">

                      <data-store path="timer-service-data" relative-to="jboss.server.data.dir"/>


                  <remote connector-ref="remoting-connector" thread-pool-name="default"/>


                      <thread-pool name="default">

                          <max-threads count="10"/>

                          <keepalive-time time="100" unit="milliseconds"/>



                  <iiop enable-by-default="false" use-qualified-name="false"/>




      Please let me know if you have any clue on this issue…