From e12fc216edf468b8a17e3cbddf26978d11cc8bc7 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Tue, 1 Mar 2016 12:29:31 -0500 Subject: [PATCH] Add more debug logging for closed file issues This commit adds additional debug logging to the subunit gearman worker to try and identify the source of the closed file bug we're hitting in production. This adds logging of the memory address where the cStringIO.StringIO objects before and after being pushed on the queue. It also adds a distinct message for the object if it's closed before or after being on the queue. Change-Id: I4a4f064e8885f8f9c8fc2974c0f71d837f41454e --- files/subunit-gearman-worker.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/files/subunit-gearman-worker.py b/files/subunit-gearman-worker.py index 90be15a..5780f8d 100644 --- a/files/subunit-gearman-worker.py +++ b/files/subunit-gearman-worker.py @@ -86,7 +86,11 @@ class SubunitRetriever(threading.Thread): job.sendWorkException( 'Unable to retrieve subunit stream'.encode('utf8')) else: - logging.debug("Pushing subunit files.") + if subunit_io.closed: + logging.debug("Pushing closed subunit file: %s" % + subunit_io) + else: + logging.debug("Pushing subunit file: %s" % subunit_io) out_event = fields.copy() out_event["subunit"] = subunit_io self.subunitq.put(out_event) @@ -180,7 +184,12 @@ class Subunit2SQLProcessor(object): shell.CONF.set_override('artifacts', log_dir) shell.CONF.set_override('run_meta', subunit) # Parse subunit stream and store in DB - logging.debug('Converting Subunit V2 stream to SQL') + if subunit_v2.closed: + logging.debug('Trying to convert closed subunit v2 stream: %s to ' + 'SQL' % subunit_v2) + else: + logging.debug('Converting Subunit V2 stream: %s to SQL' % + subunit_v2) stream = read_subunit.ReadSubunit(subunit_v2, targets=self.extra_targets) results = stream.get_results()