[rabbitmq-discuss] Pika 0.9.5 KeyError: Tx.SelectOk

Matt Pietrek mpietrek at skytap.com
Wed Mar 14 20:40:10 GMT 2012


I'm experiencing a KeyError exception, where the key is "Tx.SelectOk" when
using Pika 0.9.5.

The scenario: A simple program that simply writes two messages a second to a
queue. While this test is running, I stop the broker, then restart it a few
seconds later. I explicitly check for AMQPConnectionError exceptions, and if
seen reconnect to the broker. About half the time, the test works as
intended. However, other times I see the KeyError exception, which my guess
is not what's intended.

My writing code looks like this:
            try:
                channel = self._channel
                channel.tx_select()
                channel.basic_publish(exchange='',
                    routing_key=queue_name,
                    body=json_string,
                    properties=pika.BasicProperties(delivery_mode=2))
                channel.tx_commit()
                return
            except AMQPConnectionError as e:
                self._reconnect()

Digging into the traceback data, the faulting line is in Pika's
blocking_connection.py:rpc()

        # Find our reply in our list of replies
        for reply in self._replies:
            if reply in replies:
                frame = self._frames[reply] # THIS HERE IS THE LINE
                self._received_response = True
                if callback:
                    callback(frame)
                del(self._frames[reply])
                return frame

Known issue? Expected and acceptable? Thoughts?

Thanks,

Matt


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120314/5229e21f/attachment.htm>


More information about the rabbitmq-discuss mailing list