From 0dfcdaa16eef1910b1a271bba32d4e365cff7e51 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Thu, 8 Mar 2012 01:36:44 -0800 Subject: Exceptions unpacking rpc messages shouldn't hang the daemon Fixes bug 949731 Change-Id: I83218012c37f7e5f16b2de8d26a738ac71eb89b4 --- nova/rpc/impl_kombu.py | 7 +++++-- nova/rpc/impl_qpid.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'nova/rpc') diff --git a/nova/rpc/impl_kombu.py b/nova/rpc/impl_kombu.py index 8f527467f..f78005e3c 100644 --- a/nova/rpc/impl_kombu.py +++ b/nova/rpc/impl_kombu.py @@ -104,8 +104,11 @@ class ConsumerBase(object): def _callback(raw_message): message = self.channel.message_to_python(raw_message) - callback(message.payload) - message.ack() + try: + callback(message.payload) + message.ack() + except Exception: + LOG.exception(_("Failed to process message... skipping it.")) self.queue.consume(*args, callback=_callback, **options) diff --git a/nova/rpc/impl_qpid.py b/nova/rpc/impl_qpid.py index 88e820e82..8b10b7547 100644 --- a/nova/rpc/impl_qpid.py +++ b/nova/rpc/impl_qpid.py @@ -406,7 +406,10 @@ class Connection(object): def _consume(): nxt_receiver = self.session.next_receiver(timeout=timeout) - self._lookup_consumer(nxt_receiver).consume() + try: + self._lookup_consumer(nxt_receiver).consume() + except Exception: + LOG.exception(_("Error processing message. Skipping it.")) for iteration in itertools.count(0): if limit and iteration >= limit: -- cgit