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
This commit is contained in:
parent
4205740b67
commit
2dc98bea8d
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue