Unable to receive messages: The Consumer is closed

Steps to reproduce

Seen intermittently (during an adminui index rebuild most recently), not sure what causes this:

Activity

Show:
Stephen Marquard
April 19, 2017, 12:40 PM

Still seeing this intermittently during normal workflow processing (i.e. not during index rebuild)

2017-04-19 09:45:33,672 | ERROR | pool-84-thread-1 | (MessageReceiverImpl:90) - Unable to receive messages
javax.jms.IllegalStateException: The Consumer is closed
at org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:772)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.getMessageListener(ActiveMQMessageConsumer.java:374)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQSession.checkMessageListener(ActiveMQSession.java:1959)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.checkMessageListener(ActiveMQMessageConsumer.java:791)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:496)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl.waitForMessage(MessageReceiverImpl.java:87)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl.getSerializable(MessageReceiverImpl.java:108)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:131)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:128)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

2017-04-19 11:53:01,924 | ERROR | pool-78-thread-1 | (MessageReceiverImpl:90) - Unable to receive messages
javax.jms.IllegalStateException: The Consumer is closed
at org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:772)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.getMessageListener(ActiveMQMessageConsumer.java:374)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQSession.checkMessageListener(ActiveMQSession.java:1959)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.checkMessageListener(ActiveMQMessageConsumer.java:791)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:496)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl.waitForMessage(MessageReceiverImpl.java:87)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl.getSerializable(MessageReceiverImpl.java:108)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:131)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:128)[167:matterhorn-message-broker-impl:2.3.0.SNAPSHOT]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]

Former user
July 25, 2017, 12:00 PM

Bug: The MessageReceiverImpl.waitForMessage() is failing to catch the IllegalStateException and failing log a TRACE message that "The Consumer is closed" when the consumer closes.

Stephen Marquard
July 25, 2017, 12:02 PM

It seems this like is harmless (except for the overly verbose logging) but I'm curious as to why the consumer would ever be closed.

Former user
July 25, 2017, 1:35 PM
Edited

Well, then it may be a sign of a bug if an active message consumer closes its connection (intentionally via code or timeout) thereby refusing to consume pending ActiveMQ messages from the message broker.

-------------------
From ActiveMQMessageConsumer.java
----------------
...
// These are the messages waiting to be delivered to the client
protected final MessageDispatchChannel unconsumedMessages;
...
/**

  • @throws IllegalStateException
    */
    protected void checkClosed() throws IllegalStateException {
    if (unconsumedMessages.isClosed()) {
    throw new IllegalStateException("The Consumer is closed");
    }
    }
    ...
    public MessageListener getMessageListener() throws JMSException {
    checkClosed();
    return this.messageListener.get();
    }

Stephen Marquard
February 13, 2019, 10:03 AM

Still seeing this on 6.x

2019-02-13 11:58:14,329 | ERROR | pool-104-thread-1 | (LiveScheduleMessageReceiver$MessageWatcher:128) - Problem while getting ASSETMANAGER.Liveschedule message events java.util.concurrent.ExecutionException: javax.jms.IllegalStateException: The Consumer is closed
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.opencastproject.liveschedule.message.LiveScheduleMessageReceiver$MessageWatcher.run(LiveScheduleMessageReceiver.java:104)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.jms.IllegalStateException: The Consumer is closed
at org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:772)
at org.apache.activemq.ActiveMQMessageConsumer.getMessageListener(ActiveMQMessageConsumer.java:374)
at org.apache.activemq.ActiveMQSession.checkMessageListener(ActiveMQSession.java:1959)
at org.apache.activemq.ActiveMQMessageConsumer.checkMessageListener(ActiveMQMessageConsumer.java:791)
at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:496)
at org.opencastproject.message.broker.impl.MessageReceiverImpl.waitForMessage(MessageReceiverImpl.java:98)
at org.opencastproject.message.broker.impl.MessageReceiverImpl.getSerializable(MessageReceiverImpl.java:123)
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:138)
at org.opencastproject.message.broker.impl.MessageReceiverImpl$1.call(MessageReceiverImpl.java:135)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 3 more

Assignee

Unassigned

Reporter

Stephen Marquard

Severity

Incorrectly Functioning Without Workaround

Tags (folksonomy)

None

Components

Affects versions

Priority

Major
Configure