From: Kefu Chai Date: Wed, 25 Feb 2015 08:10:51 +0000 (+0800) Subject: Thrasher: log backtrace of thrown exception X-Git-Tag: v0.94.10~27^2^2~5^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f79027a229b2cbb16eaf877b06bf35ecff647bea;p=ceph.git Thrasher: log backtrace of thrown exception * add a wrapper to log uncaught exception to self.logger, greenlet also prints the backtrace and exception to stderr, but teuthology.log does not capture stderr. so we need to catch them by ourselves to reveal more info to root-cause this issue. * log uncaught exception thrown by Thrasher.do_thrash() to self.log. See: #10630 Signed-off-by: Kefu Chai (cherry picked from commit 64de3cd574b200d90cb3aea0d646a6236d8fec5e) --- diff --git a/tasks/ceph_manager.py b/tasks/ceph_manager.py index 45bbade02a00..71722232f711 100644 --- a/tasks/ceph_manager.py +++ b/tasks/ceph_manager.py @@ -2,6 +2,7 @@ ceph manager -- Thrasher and CephManager objects """ from cStringIO import StringIO +from functools import wraps import contextlib import random import time @@ -10,6 +11,7 @@ import base64 import json import logging import threading +import traceback import os from teuthology import misc as teuthology from tasks.scrub import Scrubber @@ -644,6 +646,17 @@ class Thrasher: val -= prob return None + def log_exc(func): + @wraps(func) + def wrapper(self): + try: + return func(self) + except: + self.log(traceback.format_exc()) + raise + return wrapper + + @log_exc def do_thrash(self): """ Loop to select random actions to thrash ceph manager with.