0
votes

I am using spring-rabbit-1.7.1 library for rabbitmq consumer in java. I have 7 consumers running and same servers are producers as well. Suddenly consumers stopped consuming messages and resumed when i restarted them. There were no exceptions and thread dump is as follow:

      SimpleAsyncTaskExecutor-1" #77 prio=5 os_prio=0 tid=0x00007f497ef34800 nid=0x4e93 waiting on condition [0x00007f490cee6000]
   java.lang.Thread.State: TIMED_WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x000000064c00bfa0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
        at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
        at org.springframework.amqp.rabbit.listener.BlockingQueueConsumer.nextMessage(BlockingQueueConsumer.java:439)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.doReceiveAndExecute(SimpleMessageListenerContainer.java:1212)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.receiveAndExecute(SimpleMessageListenerContainer.java:1187)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.access$1600(SimpleMessageListenerContainer.java:96)
        at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContai

"AMQP Connection 10.66.107.115:5672" #78 prio=5 os_prio=0 tid=0x00007f49901a5000 nid=0x4e94 runnable [0x00007f490cde5000]
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        - locked <0x000000064c3534d0> (a java.io.BufferedInputStream)
        at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288)

Producers are working fine as number of messages in queue is creeping up.

1

1 Answers

0
votes

The current 1.7.x version is 1.7.10.

Make sure that enableAutoRecovery is false in the underlying RabbitMQ ConnectionFactory. It is set to true by default in the 4.0.x client; Spring AMQP doesn't need the client auto-recovery because it has had its own recovery mechanism since 1.0.0.

There have been several bug fixes to solve most compatibility problems, but it should be set to false. Spring AMQP will disable it automatically, unless you provide a pre-configured RabbitMQ ConnectionFactory - such as with spring-cloud-connectors on PCF.

This has been fixed in the 2.0.3 version of the connectors.