diff options
author | Tobias Henkel <tobias.henkel@bmw.de> | 2020-09-11 09:08:49 +0200 |
---|---|---|
committer | Tobias Henkel <tobias.henkel@bmw.de> | 2020-09-11 09:26:33 +0200 |
commit | 2dc98bea8dc66ba9dfd0288d5faa3a2cc00916b7 (patch) | |
tree | dc08c6aef996d0e30ee8907ab2678ed55879061e /zuul | |
parent | 4205740b67a70739734930a019de47b7f3e664b1 (diff) | |
download | zuul-2dc98bea8dc66ba9dfd0288d5faa3a2cc00916b7.tar.gz |
Clear traceback before attaching exception to event
When we hit an exception in a management event we attach it to the
event so the sender of the event can get the stack trace back. However
the traceback also contains the local variables of all frames part of
the traceback. Those also can contain references to Tenant objects
which will be blocked for the gc until the event is (hopefully)
collected as well. Since we're only interested in the stack traces and
don't need the local variables clear the frames before attaching the
traceback to the event.
Change-Id: I57854ac4b9d1405d2b7b86f27149f87af968e77a
Diffstat (limited to 'zuul')
-rw-r--r-- | zuul/scheduler.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/zuul/scheduler.py b/zuul/scheduler.py index 8e0738236..83f620fec 100644 --- a/zuul/scheduler.py +++ b/zuul/scheduler.py @@ -25,6 +25,7 @@ import socket import sys import threading import time +import traceback import urllib from zuul import configloader @@ -1385,7 +1386,11 @@ class Scheduler(threading.Thread): event.done() except Exception: self.log.exception("Exception in management event:") - event.exception(sys.exc_info()) + type, val, tb = sys.exc_info() + # Remove local variables from the traceback to prevent leaking + # large objects. + traceback.clear_frames(tb) + event.exception((type, val, tb)) self.management_event_queue.task_done() def process_result_queue(self): |