[rabbitmq-discuss] Pika 0.9.5 - How to handle Rabbit Stop ?

David Myllykangas david.myllykangas at ericsson.com
Wed Aug 29 10:42:17 BST 2012


Hi

We are using Rabbit 2.8.5 and Pika 0.9.5 to process rabbit-queue from python.

If I am doing a 'rabbitctrl stop' to stop Rabbit Server, my python script hangs, and get uninteruptable.

This is the console output I get when I stop the Rabbit Server

Traceback (most recent call last):
  File ".../pycims/queue.py", line 87, in start_consuming
    connection.ioloop.start()
  File ".../pika/adapters/select_connection.py", line 124, in start
    self.poller.start()
  File ".../pika/adapters/select_connection.py", line 374, in start
    self.poll()
  File ".../pika/adapters/select_connection.py", line 388, in poll
    self._handler(events[0][0], events[0][1])
  File ".../pika/adapters/base_connection.py", line 137, in _handle_events
    self._handle_error(error)
  File ".../pika/adapters/base_connection.py", line 106, in _handle_error
    error_code = error[0]  # Python <= 2.5
TypeError: 'NoneType' object is not subscriptable

This is the code; (I am expecting an Exception to be thrown on line 93, so I can handle the situation.) What am I doing wrong?

86        try:
87            connection.ioloop.start()
88        except KeyboardInterrupt:
89            self.stop_consuming()
90            connection.ioloop.stop()
91            connection.close()
92            raise
93        except Exception, e:
94            print 'Exception %s' % str(e)
95            raise

Thanks,
 David

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


More information about the rabbitmq-discuss mailing list