4 Replies Latest reply on Apr 18, 2012 10:31 AM by jaikiran

    Lots n Lots of stateless bean instances.

    raj_kumar

      All,

       

      I am using Jboss 5.1, One of my stateless bean which is heavily used. After runinng for 7 days my Jboss occupies all of memory (6G heap on solaris) and goes into unresponsive state. I took a heap dump and analysed, i found that it shows 15,238,735 instances of a particular stateless bean in JVisualVM. My beans is accessed locally and remotely both.

       

      I am not able to find out why these many instances has been created in Jboss.

       

      Can you please tell me how to control the instances in my stateless?

       

      below is the configuration of ejb3-interceptors-aop.xml file.. I assume this confguration stands true for all beans in jboss container

       

      -<domain name="Stateless Bean" inheritBindings="true" extends="Intercepted Bean"> -<bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.ENCPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.security.AuthenticationInterceptorFactory"/> </bind> -<bind pointcut="execution(public * @org.jboss.ejb3.annotation.SecurityDomain->*(..))"> <interceptor-ref name="Basic Authorization"/> </bind> -<bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.ejb3.security.RunAsSecurityInterceptorFactory"/> </bind> -<bind pointcut="execution(public * @org.jboss.ejb3.annotation.Clustered->*(..))"> <interceptor-ref name="org.jboss.ejb3.remoting.ReplicantsManagerInterceptorFactory"/> </bind> -<bind pointcut="execution(public * *->*(..))"> <interceptor-ref name="org.jboss.aspects.tx.TxPropagationInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.CMTTxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.stateless.StatelessInstanceInterceptor"/> <interceptor-ref name="org.jboss.ejb3.tx.BMTTxInterceptorFactory"/> <interceptor-ref name="org.jboss.ejb3.AllowedOperationsInterceptor"/> <interceptor-ref name="org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor"/>

      <!-- interceptor-ref name="org.jboss.ejb3.interceptor.EJB3InterceptorsFactory"/ -->

      <stack-ref name="EJBInterceptors"/> </bind> <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)"> @org.jboss.ejb3.annotation.Pool (value="ThreadlocalPool", maxSize=30, timeout=10000) </annotation> </domain>

       

       

      I looked into jmx-console then it says MaxSize =47 and AvailableCount=-8

       

       

      Your input is really appreciated.

      Thanks

      Raj..

        • 1. Re: Lots n Lots of stateless bean instances.
          wdfink

          How you use the SLSB? I suppose you mean that it is exact one SLSB class.

           

          It might be a indicator that an instance is created instead of using the container because the container returns only a proxy and not the real instance.

           

          BTW what version of JBoss 5.1 community/EAP? I did not see such behaviour with an actual 5.1.

          • 2. Re: Lots n Lots of stateless bean instances.
            raj_kumar

            There are many EJB's in my system, but one of my stateless bean is extensively used, I am using Jboss AS 5.1.

             

            Today i one of my setup i saw that bean properties in jmx-console is :-

             

            CurrentSize =1716

            MaxSize=1716

            AvailbaleCount=3

             

            This bean is used remotely and locally through remote and local interface

            I am not sure why sever is creating such a huge no. instance of the this stateless bean. Is there some way to control it?

             

            How about pools, is there seperate pool when bean called locally and remotely?

             

            Your reply will be appreciated.

            • 3. Re: Lots n Lots of stateless bean instances.
              wdfink

              There is only one pool for SLSB.

               

              My idea ATM is that the SLSB is blocked, n that case there should be also lots of 'hanging' threads.

              Other is that instances of the SLSB are created and stored somewhere without releasing the reference.

               

              A threaddump might help.

              Or you have to do a deep step into the memory and find out the owner of the references to your SLSB.

              • 4. Re: Lots n Lots of stateless bean instances.
                jaikiran

                I think Raj is using a ThreadLocalPool whose upper limit is unbounded https://community.jboss.org/message/586260#586260. Switch to StrictMaxPool to control the max number of beans in the pool.

                1 of 1 people found this helpful