Exceptions unpacking rpc messages shouldn't hang the daemon

Fixes bug 949731

Change-Id: I83218012c37f7e5f16b2de8d26a738ac71eb89b4
This commit is contained in:
Chris Behrens
2012-03-08 01:36:44 -08:00
parent 0193d1253c
commit 0dfcdaa16e
6 changed files with 54 additions and 9 deletions

View File

@@ -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)

View File

@@ -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: