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
This commit is contained in:
Matthew Treinish 2016-03-01 12:29:31 -05:00
parent f4667bbba4
commit e12fc216ed
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 11 additions and 2 deletions

View File

@ -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()