9 Replies Latest reply on Feb 14, 2013 7:39 AM by adryen31

    Use global pools with in vm connector/acceptor ?

    adryen31

      Hello all,

       

      I have a HornetQ server which start during startup of my webapp (is an embedded HornetQ)

      I use the following configuration:

       

       

      <configuration xmlns="urn:hornetq"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
      
         <paging-directory>C:\Java\Workspaces\Indigo\res\hornetq\paging</paging-directory>
         
         <bindings-directory>C:\Java\Workspaces\Indigo\res\hornetq\bindings</bindings-directory>
         
         <journal-directory>C:\Java\Workspaces\Indigo\res\hornetq\journal</journal-directory>
         
         <large-messages-directory>C:\Java\Workspaces\Indigo\res\hornetq\large-messages</large-messages-directory>
         
         <journal-min-files>10</journal-min-files>
         
            <connectors>
            <connector name="webapp-connector">
              <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>
               <param key="server-id" value="${hornetq.server-id:0}"/>
            </connector>
         </connectors>
      
      
         <acceptors>
            <acceptor name="webapp-acceptor">
               <factory-class>
                     org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory
                 </factory-class>
                 <param key="server-id" value="0"/>
            </acceptor>
         </acceptors>
      
      
         <security-enabled>false</security-enabled>
         
         <persistence-enabled>false</persistence-enabled>
         
         <shared-store>false</shared-store>
      </configuration>
      
      

       

       

      My problem is, when I stop my webapp in tomcat server, following line is loggued:

       

      6 févr. 2013 19:10:40 org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [f7adea47-6ba2-11e2-b4e0-8df5c7f2c714] stopped

       

      Consequently HornetQ is correctly stopped with my webapp, but below following trace appears:

       

      6 févr. 2013 19:10:40 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads

      GRAVE: The web application [/mywebapp] appears to have started a thread named [Thread-1 (HornetQ-client-global-threads-15529480)] but has failed to stop it. This is very likely to create a memory leak.

      6 févr. 2013 19:10:40 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads

      GRAVE: The web application [/mywebapp] appears to have started a thread named [Thread-0 (HornetQ-client-global-scheduled-threads-17614142)] but has failed to stop it. This is very likely to create a memory leak.

       

      I check a heap.dump and I see all HornetQ thread is in zombis status "WAIT" status like:

       

      [Thread-3 (HornetQ-scheduled-threads-18439316)]

      [Thread-29 (HornetQ-server-HornetQServerImpl::serverUUID=ca2cb5b6-6bb0-11e2-baed-4332c050da13-68103)]

      [Thread-0 (HornetQ-remoting-threads-HornetQServerImpl::serverUUID=ca2cb5b6-6bb0-11e2-baed-4332c050da13-2167514-22853821)]

      [Thread-1 (HornetQ-client-global-threads-20868998)]

      [Thread-0 (HornetQ-client-global-scheduled-threads-783145)]

       

      I think maybe threads that may be attached to the pool of Tomcat no ? I found use-global-pools property which can take false but event

      with documentation I don't know if it can resolve my problem, and I think it's an option only for JMS connectors no ?

       

      Great thank and best regards,

       

      Adrien

        • 1. Re: Use global pools with in vm connector/acceptor ?
          ataylor

          it looks like client threads, do you have the HQ resource adapter deployed, maybe its that not being stopped.

          • 2. Re: Use global pools with in vm connector/acceptor ?
            adryen31

            No I think, deployed adapter is declared in hornetq-configuration.xml or web.xml (normally) ?

             

            I precise HornetQ-Version: 2.2.14.Final (HQ_2_2_14_FINAL, 122)

             

            thank

            • 3. Re: Use global pools with in vm connector/acceptor ?
              ataylor

              ive ni idea in Tomcat how the Resource Adapter is deployed.

               

              Also your thread dump doesn't contain the threads that Tomcat warns about.

               

              All i can think is you have some clients running in the Tomcat server still that need closing.

              1 of 1 people found this helpful
              • 4. Re: Use global pools with in vm connector/acceptor ?
                adryen31

                Thank Andy I have found an reference which maintain most of thread, that said, I still have yet to unlock, but I can not figure out where the lock.

                 

                Can you have an idea how I can investigate more investigate deeper ? is that which remains in the WAITING

                 

                "Thread-0 (HornetQ-client-global-scheduled-threads-997690982)" - Thread t@93

                   java.lang.Thread.State: WAITING

                          at sun.misc.Unsafe.park(Native Method)

                          - parking to wait for <406fcc9c> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)

                          at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)

                          at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1987)

                          at java.util.concurrent.DelayQueue.take(DelayQueue.java:160)

                          at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:609)

                          at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:602)

                          at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:947)

                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)

                          at java.lang.Thread.run(Thread.java:662)

                 

                 

                   Locked ownable synchronizers:

                          - None

                • 5. Re: Use global pools with in vm connector/acceptor ?
                  adryen31

                  I have found how to avoid this thread waiting problem for the scheduler but now when I stop my HornetQ I have the following thread in waiting state "HornetQ-client-factory-pinger-threads-299804241-1472872240" how I can

                  shutdown this thread at the stop of HornetQ ?

                   

                  thank

                  • 6. Re: Use global pools with in vm connector/acceptor ?
                    ataylor

                    like i said before, make sure all HornetQ resoucres have been closed and the HornetQ server has been stopped. There shouldn't be any threads left running

                    • 7. Re: Use global pools with in vm connector/acceptor ?
                      adryen31

                      but how I can check if my all HornetQ resources is closed ? I have close all channels, client producers, consumers, factories ... before the stop

                      • 8. Re: Use global pools with in vm connector/acceptor ?
                        ataylor

                        close all clients, close the Resource Adapter if you are using it and stop the HornetQ Server.

                        • 9. Re: Use global pools with in vm connector/acceptor ?
                          adryen31

                          I have investiguate with JMX console and I found after the stop() my

                           

                                <acceptor name="invm-acceptor">

                                   <factory-class>

                                         org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory

                                     </factory-class>

                                     <param key="server-id" value="0"/>

                                </acceptor>

                          isn't close do you have an idea ?