qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Loberg (JIRA)" <j...@apache.org>
Subject [jira] [Created] (QPID-7178) Auto-delete queue removed while it has consumers
Date Fri, 01 Apr 2016 08:59:25 GMT
Paul Loberg created QPID-7178:

             Summary: Auto-delete queue removed while it has consumers
                 Key: QPID-7178
                 URL: https://issues.apache.org/jira/browse/QPID-7178
             Project: Qpid
          Issue Type: Bug
          Components: Java Client, Python Client
            Reporter: Paul Loberg

We seem to have run into a bug where we create a queue with auto-delete=true from Python and
then send to it using the JMS client. When the JMS MessageProducer is closed the queue is
removed even if the Python client is still consuming from it.

We first create the queue from Python (qpid-python 0.32, Python 2.7) and send a message to
another queue "foo-bar" with the newly created auto-delete queue as the reply-to address.
The connection and session is kept open until a response is received.

A very cut down version of the Python code is below. The client will call create_queue, send_request
and then await_response and in await_response we then (9 out of 10 times) get:

  File "client.py", line NN, in await_response
    receiver = self._session.receiver(self._queue_name)
  File "<string>", line 6, in receiver
  File "/usr/lib/python2.7/site-packages/qpid/messaging/endpoints.py", line 653, in receiver
  File "<string>", line 6, in close
  File "/usr/lib/python2.7/site-packages/qpid/messaging/endpoints.py", line 1114, in close
    if not self.session._ewait(lambda: self.closed, timeout=timeout):
  File "/usr/lib/python2.7/site-packages/qpid/messaging/endpoints.py", line 597, in _ewait
  File "/usr/lib/python2.7/site-packages/qpid/messaging/endpoints.py", line 586, in check_error
    raise self.error
qpid.messaging.exceptions.NotFound: not-found: Queue not found: 17980224d7004b88b503a71c0c471bfa

from qpidtoollibs import BrokerAgent
def create_queue(self):
   queue_name = self._queue_name = uuid.uuid4().get_hex()
   agent = BrokerAgent(self._connection)
   declargs = {"auto-delete": "true"}
   agent.addQueue(queue_name, declargs)

def send_request(self, content_dict):
   sender = self._session.sender(self._foo_queue_name)
      message = Message(content=json_content, reply_to=self._queue_name)

def await_response(self, timeout_secs):
   receiver = self._session.receiver(self._queue_name)
   msg = receiver.fetch(timeout=timeout_secs)
   return msg

On the Java side we connect using JMS (0.8.0) and wait for a message to arrive in the "foo-bar"
queue. Once it does it will create a MessageProducer using the reply-to Destination object
(from the incoming Message.getJMSReplyTo) and send a response back, but when that MessageProducer
is closed the auto-delete queue seems to be removed even if we have the Python client connected
to it.

A very simplified version of the Java code:

class BrokerConnection implements MessageListener {
   Connection connection;
   Session session;
   MessageConsumer messageConsumer;

   public BrokerConnection(ConnectionFactory connectionFactory) {
      connection = connectionFactory.createConnection();
      session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Destination queue = session.createQueue("foo-bar");
      messageConsumer = session.createConsumer(queue);

   public void onMessage(Message message) {
      Destination clientQueue = message.getJMSReplyTo();

      try (MessageProducer prod = session.createProducer(clientQueue)) {
         BytesMessage msg = session.createBytesMessage();
      } // implicit prod.close()

However, if we in the JMS onMessage() convert the reply to address to a String and re-create
the Destination from that String, instead of using the Destination from getJMSReplyTo(), it
seems to work as expected.

   public void onMessage(Message message) {
      String replyTo = ((Queue)message.getJMSReplyTo()).getQueueName();

      Destination clientQueue = session.createQueue(replyTo);
      try (MessageProducer prod = session.createProducer(clientQueue)) {
         BytesMessage msg = session.createBytesMessage();
      } // implicit prod.close()

>From this behavior we suspect a bug in the Java/JMS client code causing the consumer count
in the broker to be incorrect with the first approach.

Please let us know if we can provide more details to track down this issue.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org

View raw message