From 48b73f6857e8b309c5c8e077baa32bee5b890de3 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 27 Feb 2015 12:17:28 -0500 Subject: [PATCH] Better handle random exceptions in console plugins If a console plugin raises some unrecognized exception, handle it more gracefully with trace log capture and moving on. --- confluent_server/confluent/consoleserver.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/confluent_server/confluent/consoleserver.py b/confluent_server/confluent/consoleserver.py index 0aed49b6..37a70161 100644 --- a/confluent_server/confluent/consoleserver.py +++ b/confluent_server/confluent/consoleserver.py @@ -227,6 +227,17 @@ class _ConsoleHandler(object): if not self.reconnect: self.reconnect = eventlet.spawn_after(retrytime, self._connect) return + except Exception: + _tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event, + event=log.Events.stacktrace) + self.error = 'unknown' + self.connectstate = 'unconnected' + self._send_rcpts({'connectstate': self.connectstate, + 'error': self.error}) + retrytime = 30 + (30 * random.random()) + if not self.reconnect: + self.reconnect = eventlet.spawn_after(retrytime, self._connect) + return self._got_connected() def _got_connected(self):