[
https://issues.apache.org/jira/browse/AMQ-6194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15358593#comment-15358593
]
HÃ¥kan Johansson commented on AMQ-6194:
--------------------------------------
In our production test environment this bug causes the ActiveMQ kahadb store
limit to be reached, even though there is not a single message currently in the
broker. The "data/kahadb" directory fills up with database log files, stopping
the broker from working.
We have several clients using request-response where the response queue is a
temporary queue. Each client has its own temporary queue which is reused for
all requests during the lifetime of the client process, as recommended [by the
ActiveMQ
documentation|http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html].
When we look at the temp queues using hawtio we see that the _EnqueueCount_ is
always two times the _DequeueCount_, even though no messages can be fetched
from the queue, aka "ghost" messages.
Because of the seriousness of this issue I would consider this issue to be at
least _Major_, not _Minor_ as it is today.
If we manually build ActiveMQ with this patch, then this issue goes away, but
we would prefer to have an official release instead.
We would be very happy if a new release containing this fix could be
prioritized.
> Deleting a temporary queue creates a warning message in the broker
> ------------------------------------------------------------------
>
> Key: AMQ-6194
> URL: https://issues.apache.org/jira/browse/AMQ-6194
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker, JMS client
> Affects Versions: 5.12.1, 5.13.1
> Reporter: David Dou
> Assignee: Christopher L. Shannon
> Priority: Minor
> Fix For: 5.14.0
>
> Attachments: AMQ6194Test.java
>
>
> When deleting a temporary queue, the ActiveMQ 5.13.1 (and 5.12.2) broker logs
> the following warning message:
> {noformat}
> INFO [ActiveMQ NIO Worker 111] [TempQueue]
> temp-queue://ID:brokerHostname-57582-1455804170203-8569:1:1 on dispose, purge
> of 1 pending messages:
> org.apache.activemq.broker.region.cursors.VMPendingMessageCursor@e0f6196
> WARN [ActiveMQ NIO Worker 111] [Queue]
> temp-queue://ID:brokerHostname-57582-1455804170203-8569:1:1 after purge of 1
> messages, message count stats report: 1
> {noformat}
> The cause of this warning seems to be the publication of a "ghost" message
> when sending a single message on the temporary queue from a transacted
> session, as demonstrated by this test class:
> {code:java}
> import java.text.SimpleDateFormat;
> import java.util.Date;
> import javax.jms.Connection;
> import javax.jms.JMSException;
> import javax.jms.MessageProducer;
> import javax.jms.Session;
> import javax.jms.TemporaryQueue;
> import javax.jms.TextMessage;
> import org.apache.activemq.ActiveMQConnectionFactory;
> public class GhostMessageOnTempQueueWithTransactedSessionDemo {
> public static void main(final String[] args) throws JMSException {
> final ActiveMQConnectionFactory factory = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
> Connection connection = null;
> Session session = null;
> MessageProducer producer = null;
> TemporaryQueue temporaryQueue = null;
> try {
> connection = factory.createConnection();
> connection.start();
> // The session has to be transacted for the second "ghost"
> message to appear (see below).
> session = connection.createSession(true,
> Session.SESSION_TRANSACTED);
> // And the publication has to be on a temporary queue (if the
> temporary queue is created by another process, the second "ghost" message
> still appears).
> temporaryQueue = session.createTemporaryQueue();
> producer = session.createProducer(temporaryQueue);
> final TextMessage textMessage = session.createTextMessage();
> textMessage.setText("GhostMessageDemo@" + new
> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss,SSSZ").format(new Date()));
> producer.send(textMessage);
> // Here, in ActiveMQ 5.13.1 and 5.12.2, the message was sent but
> cannot be browsed or consumed. It can however be seen in the JMX console with:
> // - EnqueueCount, that was increased by one;
> // - MemoryUsageByteCount (by sending huge messages of different
> size to ensure that it is indeed the real message).
> // In ActiveMQ 5.10.2 (and 5.4.1), it is not sent (even though
> SocketOutputStream.socketWrite is still called through TcpFormat.oneway?).
> session.commit();
> // Here, in ActiveMQ 5.13.1, a "ghost" message was sent
> (EnqueueCount has increased by one again) and the real message is visible and
> can be consumed.
> // If rollback is called instead, the real message stays (and
> cannot be consumed since the "ghost" message is not sent).
> } finally {
> if (producer != null)
> producer.close();
> if (temporaryQueue != null)
> // Here, if there was a consumer on the queue, it would have
> consumed the real message, leaving the "ghost" message that lead to the
> broker warning.
> temporaryQueue.delete();
> if (session != null)
> session.close();
> if (connection != null) {
> connection.stop();
> connection.close();
> }
> }
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)