From a40fa12dc157a2b28e1646cf1d6a00acdd4b25d8 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 24 Mar 2017 12:33:36 -0600 Subject: [PATCH] Patch gevent.Hub.handle_error So we don't miss out on any fun exceptions! Lifted from: https://github.com/ceph/calamari/commit/7edc4cfc7159175a552222700810dc943a0ca8ce Signed-off-by: Zack Cerza --- teuthology/__init__.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/teuthology/__init__.py b/teuthology/__init__.py index d037f53a18..ffafee9af2 100644 --- a/teuthology/__init__.py +++ b/teuthology/__init__.py @@ -19,6 +19,7 @@ monkey.patch_all( subprocess=False, ) import sys +from gevent.hub import Hub # Don't write pyc files sys.dont_write_bytecode = True @@ -93,3 +94,17 @@ def install_except_hook(): exc_traceback)) sys.__excepthook__(exc_type, exc_value, exc_traceback) sys.excepthook = log_exception + + +def patch_gevent_hub_error_handler(): + Hub._origin_handle_error = Hub.handle_error + + def custom_handle_error(self, context, type, value, tb): + if not issubclass(type, Hub.SYSTEM_ERROR + Hub.NOT_ERROR): + log.error("Uncaught exception (Hub)", exc_info=(type, value, tb)) + + self._origin_handle_error(context, type, value, tb) + + Hub.handle_error = custom_handle_error + +patch_gevent_hub_error_handler() -- 2.39.5