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] [Commented] (QPID-7178) Auto-delete queue removed while it has consumers
Date Fri, 01 Apr 2016 09:09:25 GMT

    [ https://issues.apache.org/jira/browse/QPID-7178?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15221411#comment-15221411
] 

Paul Loberg commented on QPID-7178:
-----------------------------------

In case it is relevant, our connection is configured to use failover (with a single broker
to get automatic reconnects).
{noformat}
failover:(amqps://ourbokername:9500?amqp.idleTimeout=0&ssl=true&transport.trustAll=true&transport.verifyHost=false)
{noformat}

> 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:
> {noformat}
>   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
>     receiver.close()
>   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
>     self.check_error()
>   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
(/var/tmp/portage/net-misc/qpid-cpp-0.34/work/qpid-cpp-0.34/src/qpid/broker/QueueRegistry.cpp:127)(404)
> {noformat}
> {code}
> 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)
>    try:
>       message = Message(content=json_content, reply_to=self._queue_name)
>       sender.send(message)
>    finally:
>       sender.close()
> def await_response(self, timeout_secs):
>    receiver = self._session.receiver(self._queue_name)
>    msg = receiver.fetch(timeout=timeout_secs)
>    return msg
> {code}
> 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:
> {code:java}
> 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);
>       messageConsumer.setMessageListener(this);
>       connection.start();
>    }
>    public void onMessage(Message message) {
>       Destination clientQueue = message.getJMSReplyTo();
>       try (MessageProducer prod = session.createProducer(clientQueue)) {
>          BytesMessage msg = session.createBytesMessage();
>          msg.writeBytes(message.unwrap());
>          prod.send(msg);
>       } // implicit prod.close()
>    }
> }
> {code}
> 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.
> {code:java}
>    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();
>          msg.writeBytes(message.unwrap());
>          prod.send(msg);
>       } // implicit prod.close()
>    }
> {code}
> 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
(v6.3.4#6332)

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


Mime
View raw message