Uploaded image for project: 'AMQ Broker'
  1. AMQ Broker
  2. ENTMQBR-9738

Explicitly disconnect consumers when closing session administratively

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • None

      When a session is closed from the Management console (Sessions tab -> Close button), the consumer never gets notified. 

      Bug is reproducible with JMS and Core. It happens if the consumer loops in a receive(timeout) or receiveNoWait(). It also happens when the setMessageListener() has been called for callback-style reception.

      To reproduce:

      1. create a consumer (JMS or Core)
      2. use a thread to loop indefinitely using consumer.receive(1000);
      3. create a producer, send messages, verify it all works 
      4. from the Management Console, kill/close the session corresponding to the consumer.
      5. The consumer.receive*() method never returns after the session is closed. If using the setMessageListener() no more callbacks occur when new messages arrive. No exception thrown whatsoever, nothing reported in connection.setExceptionListener()

      A quick look at the code show the thread waiting on this stack:

      wait:-1, Object (java.lang)
      receive:267, ClientConsumerImpl (org.apache.activemq.artemis.core.client.impl)
      receiveImmediate:411, ClientConsumerImpl (org.apache.activemq.artemis.core.client.impl)
      getMessage:211, ActiveMQMessageConsumer (org.apache.activemq.artemis.jms.client)
      receiveNoWait:139, ActiveMQMessageConsumer (org.apache.activemq.artemis.jms.client)
      lambda$createConsumer$0:74, ActiveMQCommon (com.imagetrust.activemq)
      run:-1, ActiveMQCommon$$Lambda$15 (com.imagetrust.activemq)
      call:511, Executors$RunnableAdapter (java.util.concurrent)
      run:266, FutureTask (java.util.concurrent)
      runWorker:1149, ThreadPoolExecutor (java.util.concurrent)
      run:624, ThreadPoolExecutor$Worker (java.util.concurrent)
      run:748, Thread (java.lang) 

      Looks like ClientConsumerImpl::receive waits indefinitely (or does an indefinite loop) in line 267:

      try {
         wait(toWait); <<< 
      } catch (InterruptedException e) {
         throw new ActiveMQInterruptedException(e);
      } 

       

              rhn-support-jbertram Justin Bertram
              rh-messaging-ci Messaging CI
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: