9 Replies Latest reply on Mar 6, 2017 6:18 AM by mnovak

    Large number of artimis consumerpages in memory in wildlfy 10

    spatwary04

      we are using wildlfy 10  with artenis active mq. With paging turned on, a large number of consumerpages  accumulate in memory, and do not go away after the gc also.In the heap dump we are seeing  lot of  consumedPages in memory

      and in the end running out of memory.Below is our configuration.

       

      <address-setting name="#"

                          message-counter-history-day-limit="10" page-size-bytes="2097152"

                          max-size-bytes="10485760" redelivery-delay="2000" max-redelivery-delay="5000" redelivery-multiplier="2" max-delivery-attempts="5"/>

       

      we are creating Sessions with Session.AUTO_ACKNOWLEDGE as false

      and delivery mode to be PERSISTENT. do we still have to ackowledge ??.  One more thing on mdb

      we mark  onMessage with  @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED ) but we make a call to an stateless ejb

      with  @TransactionAttribute( TransactionAttributeType.REQUIRES_NEW ).

      Below is the memory snapshot.

       

      memorysnapshot.png

        • 1. Re: Large number of artimis consumerpages in memory in wildlfy 10
          jbertram

          Any message not automatically acknowledged by the session needs to be manually acknowledged by your application.

          • 2. Re: Large number of artimis consumerpages in memory in wildlfy 10
            spatwary04

            Sorry Justin I did not make it clear we are  creating non transacted JMS Session, with AUTO_ACKNOWLEDGE(acknowledge mode). we have the same code deployed in three server on customer site we are seeing this issue on these servers randomly. we have the same code in our QA environment but did not see this issue.

            Below is how we create session on producer side.

            s = c.createSession( false, Session.AUTO_ACKNOWLEDGE );

            • 3. Re: Large number of artimis consumerpages in memory in wildlfy 10
              jbertram

              How are you creating the sessions for consumers?

              • 4. Re: Large number of artimis consumerpages in memory in wildlfy 10
                spatwary04

                we are using MDB  which is  consuming the message. Below is the sample code.

                Dow we need  below annotation ??

                @ActivationConfigProperty(propertyName = "acknowledgeMode",

                  propertyValue = "Auto-acknowledge"),

                 

                 

                @MessageDriven(activationConfig ={

                    @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),

                    @ActivationConfigProperty(propertyName="destination", propertyValue="topic/basketTopic")

                    })

                public class BasketMDB    implements MessageListener

                private BasketEventProcessorIntf eventProcessor;

                 

                /**

                     * @param msg

                     */

                    @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED )

                    public void onMessage( Message msg ){

                 

                    // call method on  stateless ejb   with @TransactionAttribute( TransactionAttributeType.REQUIRES_NEW )

                   // This ejb is does heavy lifting . Does this matter??

                  eventProcessor.processEvent();

                }

                • 5. Re: Large number of artimis consumerpages in memory in wildlfy 10
                  jbertram

                  The default ack mode for MDBs is auto-ack, so you don't need to set that explicitly.

                   

                  Do you have a test-case you can use to reproduce this (even if it doesn't happen all the time)?

                  • 6. Re: Large number of artimis consumerpages in memory in wildlfy 10
                    spatwary04

                    unfortunately we are unable to reproduce this.. That's why we  i am looking at hornet thread as it closely resembles our issue.

                    • 7. Re: Large number of artimis consumerpages in memory in wildlfy 10
                      mnovak

                      Is BasketEventProcessorIntf stateless session bean doing something with messaging?

                       

                      Could you share your configuration and code of the producer which is sending the messages to topic?

                       

                      Thanks,

                      Mirek

                      • 8. Re: Large number of artimis consumerpages in memory in wildlfy 10
                        spatwary04

                        Below is the code we are using :

                         

                        Publisher: we are sending a java object .

                         

                        public void sendObjectMessage( Serializable object )

                            {

                                InitialContext ctx = null;

                                ConnectionFactory f = null;

                                Connection c = null;

                                Destination d = null;

                                Session s = null;

                                MessageProducer p = null;

                                try

                                {

                                    properties.setProperty( "java.naming.provider.url", "http-remoting://127.0.0.1:1199" );

                                    properties.setProperty( "java.naming.factory.initial", "org.jboss.naming.remote.client.InitialContextFactory" );

                                    properties.setProperty(Context.SECURITY_PRINCIPAL, "test");

                                      // password

                                      properties.setProperty(Context.SECURITY_CREDENTIALS, "test");

                                    ctx = new InitialContext(properties);

                                    f = (ConnectionFactory)ctx.lookup( NOTIFICATION_FACTORY );

                                    d = (Destination)ctx.lookup( destinationId );

                                    c = f.createConnection();

                                    s = c.createSession( false, Session.AUTO_ACKNOWLEDGE );

                                    p = s.createProducer( d );

                                    p.setTimeToLive(6 * 3600 * 1000);

                                        p.setDeliveryMode( DeliveryMode.PERSISTENT );

                                    ObjectMessage objMessage = s.createObjectMessage( object );

                                    p.send( objMessage );

                                    log.finest( "Sent JMS Object Message : " + objMessage );

                                }

                                catch ( Exception e )

                                {

                                    log.log( Level.SEVERE, "Error in sending JMS Object Message : " + object, e );

                                }

                                finally

                                {

                                    try

                                    {

                                        if(p != null)

                                        {

                                            p.close();

                                        }

                                  

                                        if(s != null)

                                        {

                                            s.close();

                                        }

                                       

                                        if(c != null)

                                        {

                                            c.close();

                                           

                                        }

                                       

                                    }catch(Exception e)

                                    {

                                        log.severe( e.getMessage() );

                                    }

                                }

                               

                            }

                         

                         

                        Consumer:

                         

                        @MessageDriven(activationConfig ={

                            @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Topic"),

                            @ActivationConfigProperty(propertyName="destination", propertyValue="topic/basketTopic")

                            })

                        public class BasketMDB    implements MessageListener

                        private BasketEventProcessorIntf eventProcessor;

                         

                        /**

                             * @param msg

                             */

                            @TransactionAttribute( TransactionAttributeType.NOT_SUPPORTED )

                            public void onMessage( Message msg ){

                         

                            // call method on  stateless ejb   with @TransactionAttribute( TransactionAttributeType.REQUIRES_NEW )

                           // This ejb is does heavy lifting . Does this matter??

                          eventProcessor.processEvent();

                         

                        }

                         

                        @Stateless

                        @Local(value=BasketEventProcessorIntf.class)

                        @TransactionAttribute( TransactionAttributeType.REQUIRES_NEW )

                        public class ASMProgramBasketEventProcessorBean extends BasketEventProcessorBean

                            implements BasketEventProcessorIntf

                        {

                             public processEvent(){

                        //  business logic .

                        // some heavy listing which will take some time around 2 minutes

                          }

                         

                        }

                        The message size is large. One more thing we are seeing lot of page files being created on the server.

                        • 9. Re: Large number of artimis consumerpages in memory in wildlfy 10
                          mnovak

                          I played a little with this on WF11 nightly build but could not see the leak you describe.

                           

                          I have MDB consuming messages from topic (transaction attribute NOT_SUPPORTED) and for each message there is long (30 seconds) call of stateless EJB (transaction attribute REQUIRES_NEW). How long is the EJB call?

                           

                          Do you have some special config, for example on address settings?