Skip to content

Commit

Permalink
Merge pull request #929 from selenamarie/revert-bug792118-master
Browse files Browse the repository at this point in the history
Revert "Bug 792118 - Make sure that new-style plugin hang reports (which...
  • Loading branch information
selenamarie committed Nov 9, 2012
2 parents fd8bd42 + f6951f9 commit 84bcd00
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 116 deletions.
12 changes: 3 additions & 9 deletions socorro/processor/legacy_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,9 @@ def _create_basic_processed_crash(self,
except KeyError:
pass # leaving it as None if not in the document

if int(raw_crash.get('PluginHang', False)):
processed_crash.hangid = 'fake-' + uuid
else:
processed_crash.hangid = raw_crash.get('HangID', None)

if int(raw_crash.get('Hang', False)):
processed_crash.hang_type = 1
elif int(raw_crash.get('PluginHang', False)):
processed_crash.hang_type = -1
processed_crash.hangid = raw_crash.get('HangID', None)
if 'Hang' in raw_crash:
processed_crash.hang_type = raw_crash.Hang
elif processed_crash.hangid:
processed_crash.hang_type = -1
else:
Expand Down
23 changes: 5 additions & 18 deletions socorro/processor/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,16 +567,10 @@ def processJob (self, jobTuple):
dumpfilePathname = threadLocalCrashStorage.dumpPathForUuid(jobUuid,
self.config.temporaryFileSystemStoragePath)
#logger.debug('about to doBreakpadStackDumpAnalysis')

if int(jsonDocument.get("Hang", False)):
hangType = 1
elif jsonDocument.get("PluginHang", False):
hangType = -1
elif 'hangid' in newReportRecordAsDict:
hangType = -1
else:
hangType = 0

isHang = 'hangid' in newReportRecordAsDict and bool(newReportRecordAsDict['hangid'])
# hangType values: -1 if old style hang with hangid and Hang not present
# else hangType == jsonDocument.Hang
hangType = int(jsonDocument.get("Hang", -1 if isHang else 0))
java_stack_trace = jsonDocument.setdefault('JavaStackTrace', None)
additionalReportValuesAsDict = self.doBreakpadStackDumpAnalysis(reportId, jobUuid, dumpfilePathname, hangType, java_stack_trace, threadLocalCursor, date_processed, processorErrorMessages)
newReportRecordAsDict.update(additionalReportValuesAsDict)
Expand Down Expand Up @@ -744,14 +738,7 @@ def insertReportIntoDatabase(self, threadLocalCursor, uuid, jsonDocument, date_p
crash_date = datetime.datetime.fromtimestamp(crash_time, UTC)
install_age = crash_time - installTime
email = sutil.lookupLimitedStringOrNone(jsonDocument, 'Email', 100)

# Create a fake hangid to keep the queries and webapp working for the time
# being.
if int(jsonDocument.get('PluginHang', False)):
hangid = 'fake-' + uuid
else:
hangid = jsonDocument.get('HangID', None)

hangid = jsonDocument.get('HangID',None)
process_type = sutil.lookupLimitedStringOrNone(jsonDocument, 'ProcessType', 10)
#logger.debug ('hangid: %s', hangid)
#logger.debug ('Email: %s', str(jsonDocument))
Expand Down
44 changes: 0 additions & 44 deletions socorro/unittest/processor/testProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import datetime as dt
import threading as thr

import copy

def setup_module():
testutil.nosePrintModule(__file__)

Expand Down Expand Up @@ -1210,48 +1208,6 @@ def testInsertReportIntoDatabase01():
e = expected_report_dict
assert r == e, 'expected\n%s\nbut got\n%s' % (e, r)

def testInsertReportIntoDatabase02():
"""testInsertReportIntoDatabase01: success"""
p, c = getMockedProcessorAndContext()
ooid1 = 'ooid1'
date_processed = dt.datetime(2011,2,15,1,0,0, tzinfo=UTC)
json_doc = copy.deepcopy(sample_meta_json)
json_doc['PluginHang'] = '1'
expected_report_list_with_hangid = list(expected_report_tuple)
expected_report_list_with_hangid[-3] = 'fake-ooid1'
expected_report_tuple_with_hangid = tuple(expected_report_list_with_hangid)
error_list = []
c.fakeDatabaseConnectionPool.expect('connectionCursorPair', None, None,
17)
fakeReportsTable = exp.DummyObjectWithExpectations()
fakeReportsTable.expect('columns',
None,
None,
sch.ReportsTable(logger=c.logger).columns)
fakeReportsTable.expect('insert',
(c.fakeCursor,
expected_report_tuple_with_hangid,
17,),
{ 'date_processed': date_processed })
p.reportsTable = fakeReportsTable
c.fakeDatabaseModule.expect('singleValueSql',
(c.fakeCursor,
"select id from reports where uuid = "
"'ooid1' and date_processed = timestamp "
"with time zone '2011-02-15 01:00:00+00:00'"),
{},
234)

r = p.insertReportIntoDatabase(c.fakeCursor,
ooid1,
json_doc,
date_processed,
error_list)
e = copy.deepcopy(expected_report_dict)
e['hangid'] = 'fake-ooid1'
assert r == e, 'expected\n%s\nbut got\n%s' % (e, r)


def testInsertAdddonsIntoDatabase1():
"""testInsertAdddonsIntoDatabase1: no addons"""
p, c = getMockedProcessorAndContext()
Expand Down
45 changes: 0 additions & 45 deletions socorro/unittest/processor/test_legacy_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,51 +518,6 @@ def test_create_basic_processed_crash_normal(self):
)
self.assertEqual(len(processor_notes), 0)

# test 05
processor_notes = []
raw_crash_with_pluginhang = copy.deepcopy(raw_crash)
raw_crash_with_pluginhang.PluginHang = '1'
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_with_pluginhang,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_pluginhang = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_with_pluginhang.hangid = \
'fake-3bc4bcaa-b61d-4d1f-85ae-30cb32120504'
processed_crash_with_pluginhang.hang_type = -1
self.assertEqual(
processed_crash,
processed_crash_with_pluginhang
)
self.assertEqual(len(processor_notes), 0)

# test 06
processor_notes = []
raw_crash_with_hang_only = copy.deepcopy(raw_crash)
raw_crash_with_hang_only.Hang = 16
processed_crash = leg_proc._create_basic_processed_crash(
'3bc4bcaa-b61d-4d1f-85ae-30cb32120504',
raw_crash_with_hang_only,
datetimeFromISOdateString(raw_crash.submitted_timestamp),
started_timestamp,
processor_notes,
)
processed_crash_with_hang_only = \
copy.copy(cannonical_basic_processed_crash)
processed_crash_with_hang_only.hang_type = 1
self.assertEqual(
processed_crash,
processed_crash_with_hang_only
)
self.assertEqual(len(processor_notes), 0)




def test_process_list_of_addons(self):
config = setup_config_with_mocks()
config.collect_addon = False
Expand Down

0 comments on commit 84bcd00

Please sign in to comment.