From 18bbd0207429c72bed46bf363de9ed86e924409f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 29 Nov 2012 08:57:25 -0500 Subject: [PATCH] zephyr_mirror: Don't leak zephyr_mirror processes on send_humbug failures. (imported from commit be005018672369683d9e3bdbf144f96f58af6b6c) --- bots/zephyr_mirror_backend.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bots/zephyr_mirror_backend.py b/bots/zephyr_mirror_backend.py index 1f93f9d..ca7d5b6 100755 --- a/bots/zephyr_mirror_backend.py +++ b/bots/zephyr_mirror_backend.py @@ -340,10 +340,14 @@ def process_notice(notice, log): if os.fork() == 0: # Actually send the message in a child process, to avoid blocking. - res = send_humbug(zeph) - if res.get("result") != "success": - logger.error("Error relaying zephyr:\n%s\n%s" % (zeph, res)) - sys.exit(0) + try: + res = send_humbug(zeph) + if res.get("result") != "success": + logger.error("Error relaying zephyr:\n%s\n%s" % (zeph, res)) + except Exception: + logging.exception("Error relaying zephyr:") + finally: + os._exit(0) def decode_unicode_byte_strings(zeph): for field in zeph.keys():