ActiveMQ
  1. ActiveMQ
  2. AMQ-2167

ActiveMQ producer/consumer hangs when one of the consumer didn't respond

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.3.0
    • Component/s: None
    • Labels:
      None

      Description

      We are using ActiveMQ 5.2 & Spring 2.5.4...

      We are using ActiveMQ Embeeded broker

      <bean id="jmsFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
      <property name="connectionFactory">
      <bean class="org.apache.activemq.ActiveMQConnectionFactory">
      <property name="brokerURL">
      <value>vm://localhost?broker.persistent=false</value>
      </property>
      </bean>
      </property>
      </bean>

      <bean id="destination" class=" org.apache.activemq.command.ActiveMQQueue">
      <constructor-arg ref="jmsQueueJndiName"></constructor-arg>
      </bean>

      <bean id="calendarEventContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer" >
      <property name="connectionFactory" ref="jmsFactory" />
      <property name="destination" ref="destination" />
      <property name="messageListener" ref="calendarEventProcessor" />
      <property name="messageSelector">
      <util:constant static-field="com.jpmc.spex.utils.lookup.EventCategoryConstants.EVENT_CATEGORY_CALENDAR"/>
      </property>
      </bean>

      <bean id="runtimeEventContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer" >
      <property name="connectionFactory" ref="jmsFactory" />
      <property name="destination" ref="destination" />
      <property name="messageListener" ref="runtimeEventProcessor" />
      <property name="messageSelector">
      <util:constant static-field="com.jpmc.spex.utils.lookup.EventCategoryConstants.EVENT_CATEGORY_RUNTIME"/>
      </property>
      </bean>

      <bean id="systemEventContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer" >
      <property name="connectionFactory" ref="jmsFactory" />
      <property name="destination" ref="destination" />
      <property name="messageListener" ref="systemEventProcessor" />
      <property name="concurrentConsumers" value="5" />
      <property name="messageSelector">
      <util:constant static-field="com.jpmc.spex.utils.lookup.EventCategoryConstants.EVENT_CATEGORY_SYSTEM"/>
      </property>
      </bean>

      <bean id="genericCalendarEventContainer" class="org.springframework.jms.listener.SimpleMessageListenerContainer" >
      <property name="connectionFactory" ref="jmsFactory" />
      <property name="destination" ref="destination" />
      <property name="messageListener" ref="genericCalendarEventProcessor" />
      <property name="messageSelector">
      <util:constant static-field="com.jpmc.spex.utils.lookup.EventCategoryConstants.EVENT_CATEGORY_GENERIC"/>
      </property>
      </bean>

      We are sending the email from all these listeners after doing some logic.when something happens in the SMTP side and if there is no response from SMTP side and if the Listener is waiting then the entire producer/consumer is halted.

      My Question is why One Consumer blocking all other consumer /producer. (see the stack trace which shows one of the Consumer is waiting for some response from SMTP server).

      ActiveMQ Session Task" - Thread t@2554
      java.lang.Thread.State: RUNNABLE
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:129)
      at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:97)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:237)

      • locked java.io.BufferedInputStream@13a80ea
        at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:75)
        at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:1440)
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1260)
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370)
        at javax.mail.Service.connect(Service.java:275)
        at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:389)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:342)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:338)
        at com.jpmc.ibtech.spring.email.MimeEmailService.sendEmail(MimeEmailService.java:61)
        at com.jpmc.spex.background.events.processor.AbstractEventAction.sendEmail(AbstractEventAction.java:63)
        at com.jpmc.spex.background.events.processor.AbstractEventAction.execute(AbstractEventAction.java:79)
        at com.jpmc.spex.background.events.processor.system.SystemEventAction.execute(SystemEventAction.java:47)
        at com.jpmc.ibtech.spring.jms.EventProcessor.onMessage(EventProcessor.java:101)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:531)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:466)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:435)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.executeListener(AbstractMessageListenerContainer.java:407)
        at org.springframework.jms.listener.SimpleMessageListenerContainer.processMessage(SimpleMessageListenerContainer.java:290)
        at org.springframework.jms.listener.SimpleMessageListenerContainer$2.onMessage(SimpleMessageListenerContainer.java:266)
        at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:967)
      • locked java.lang.Object@1e58347
        at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
        at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
        at java.lang.Thread.run(Thread.java:619)

      Locked ownable synchronizers:

      • locked java.util.concurrent.locks.ReentrantLock$NonfairSync@10dbec7

      See the attached ThreadDump which shows Producer is waiting..

      I saw that..I can enable ProduceFlowControl...I am just worried whether it will start spilling to the disk and create more problems.

        Activity

        Jeff Turner made changes -
        Project Import Fri Nov 26 22:32:02 EST 2010 [ 1290828722158 ]
        Rob Davies made changes -
        Fix Version/s 5.3.0 [ 11914 ]
        Resolution Fixed [ 1 ]
        Assignee Rob Davies [ rajdavies ]
        Status Open [ 1 ] Resolved [ 5 ]
        Ashok made changes -
        Summary ActiveMQ producer/consumer hangs when on of the consumer didn't respond ActiveMQ producer/consumer hangs when one of the consumer didn't respond
        Ashok made changes -
        Priority Major [ 3 ] Blocker [ 1 ]
        Ashok made changes -
        Field Original Value New Value
        Attachment Thread Dump for ActiveMQ_2.tdump [ 17791 ]
        Ashok created issue -

          People

          • Assignee:
            Rob Davies
            Reporter:
            Ashok
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development