Skip to content

Commit

Permalink
Fixes bug 1299769 - Ensute RunWatchdogRule re-generates signature usi…
Browse files Browse the repository at this point in the history
…ng thread 0. (mozilla-services#3455)
  • Loading branch information
adngdb authored Sep 1, 2016
1 parent add1074 commit ed67c74
Showing 3 changed files with 31 additions and 6 deletions.
17 changes: 15 additions & 2 deletions socorro/processor/signature_utilities.py
Original file line number Diff line number Diff line change
@@ -670,7 +670,7 @@ def _action(self, raw_crash, raw_dumps, processed_crash, processor_meta):


#==============================================================================
class SignatureRunWatchDog(Rule):
class SignatureRunWatchDog(SignatureGenerationRule):
"""ensure that the signature contains the stackwalker error message"""

#--------------------------------------------------------------------------
@@ -683,14 +683,27 @@ def _predicate(self, raw_crash, raw_dumps, processed_crash, proc_meta):

#--------------------------------------------------------------------------
def _get_crashing_thread(self, processed_crash):
# Always use thread 0 in this case, because that's the thread that
# was hanging when the software was artificially crashed.
return 0

#--------------------------------------------------------------------------
def _action(self, raw_crash, raw_dumps, processed_crash, processor_meta):
# For shutdownhang crashes, we need to use thread 0 instead of the
# crashing thread. The reason is because those crashes happen
# artificially when thread 0 gets stuck. So whatever the crashing
# thread is, we don't care about it and only want to know what was
# happening in thread 0 when it got stuck.
result = super(SignatureRunWatchDog, self)._action(
raw_crash,
raw_dumps,
processed_crash,
processor_meta
)
processed_crash['signature'] = (
"shutdownhang | %s" % processed_crash['signature']
)
return True
return result


#==============================================================================
1 change: 1 addition & 0 deletions socorro/unittest/processor/test_mozilla_processor_2015.py
Original file line number Diff line number Diff line change
@@ -101,6 +101,7 @@ def test_process_over_255_chars(self, mocked_subprocess_module):
ok_(processed_crash.success)
eq_(processed_crash.processor_notes,
'dwight; MozillaProcessorAlgorithm2015; '
'SignatureTool: signature truncated due to length; '
'SignatureTool: signature truncated due to length')
ok_(processed_crash.signature.startswith('shutdownhang'))
eq_(len(processed_crash.signature), 255)
19 changes: 15 additions & 4 deletions socorro/unittest/processor/test_signature_utilities.py
Original file line number Diff line number Diff line change
@@ -1703,6 +1703,16 @@ def get_config(self):

return CDotDict(config)

#--------------------------------------------------------------------------
def test_instantiation(self):
config = self.get_config()
srwd = SignatureRunWatchDog(config)

ok_(isinstance(srwd.c_signature_tool, CSignatureTool))
ok_(isinstance(srwd.java_signature_tool, JavaSignatureTool))

eq_(srwd._get_crashing_thread({}), 0)

#--------------------------------------------------------------------------
def test_predicate(self):
config = self.get_config()
@@ -1730,19 +1740,20 @@ def test_action(self):

raw_crash = CDotDict()
raw_dumps = {}
processed_crash = CDotDict({
'signature': 'MsgWaitForMultipleObjects | F_1152915508'
})
processed_crash = CDotDict(sample_json_dump)
processed_crash.signature = 'foo::bar' # set a fake signature
processor_meta = CDotDict({
'processor_notes': []
})

# the call to be tested
ok_(sgr._action(raw_crash, raw_dumps, processed_crash, processor_meta))

# Verify the signature has been re-generated based on thread 0.
eq_(
processed_crash.signature,
'shutdownhang | MsgWaitForMultipleObjects | F_1152915508'
'shutdownhang | MsgWaitForMultipleObjects | '
'F_1152915508__________________________________'
)
eq_(processor_meta.processor_notes, [])

0 comments on commit ed67c74

Please sign in to comment.