From 8f126ca1ac9b0d3b016595286c1f7d07c0a16bfa Mon Sep 17 00:00:00 2001 From: Yaarit Hatuka Date: Thu, 16 Dec 2021 02:53:04 +0000 Subject: [PATCH] mgr/telemetry: check that backtrace is not empty when redacting Some python crashes contain empty backtraces; check before redacting their final line. Fixes: https://tracker.ceph.com/issues/53604 Signed-off-by: Yaarit Hatuka --- src/pybind/mgr/telemetry/module.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/telemetry/module.py b/src/pybind/mgr/telemetry/module.py index 1346a7511e9e..3ff50d650df3 100644 --- a/src/pybind/mgr/telemetry/module.py +++ b/src/pybind/mgr/telemetry/module.py @@ -483,8 +483,10 @@ class Module(MgrModule): # redact final line of python tracebacks, as the exception # payload may contain identifying information - if 'mgr_module' in c: - c['backtrace'][-1] = '' + if 'mgr_module' in c and 'backtrace' in c: + # backtrace might be empty + if len(c['backtrace']) > 0: + c['backtrace'][-1] = '' crashlist.append(c) return crashlist -- 2.47.3