Skip to content

Commit

Permalink
bug 1745663: fix KeyError caused by CrashingThreadRule
Browse files Browse the repository at this point in the history
I made a change to handle 0-byte minidumps and skip running
minidump-stackwalk. That's fine, but I thought it made sense to "fake"
the stackwalker_data output. That turns out to cause problems with other
processor rules that have expectations for what is and isn't in the
minidump.

This scales that back a bit so that json_dump isn't set to {} which
caused the events that lead to a KeyError.
  • Loading branch information
willkg committed Dec 13, 2021
1 parent e0c32fa commit 22eea03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 2 additions & 5 deletions socorro/processor/rules/breakpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CrashingThreadInfoRule(Rule):
"""

def predicate(self, raw_crash, dumps, processed_crash, proc_meta):
return bool(processed_crash.get("json_dump", None))
return processed_crash.get("json_dump", None) is not None

def action(self, raw_crash, dumps, processed_crash, processor_meta):
processed_crash["crashing_thread"] = glom.glom(
Expand Down Expand Up @@ -333,12 +333,9 @@ def action(self, raw_crash, dumps, processed_crash, processor_meta):
# running minidump-stackwalker.
#
# This is a bad case, so we want to add a note. However, since this
# is a shortcut, we also include a basic stackwalker_data.
# is a shortcut, we also include some stackwalker_data.
stackwalker_data = {
"json_dump": {},
"mdsw_return_code": 0,
"mdsw_status_string": "EmptyMinidump",
"success": True,
"mdsw_stderr": "Shortcut for 0-bytes minidump.",
}

Expand Down
6 changes: 2 additions & 4 deletions socorro/unittest/processor/rules/test_breakpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,13 @@ def test_stuff_missing(self):
"""If there's no dump data, then this rule doesn't do anything"""
raw_crash = copy.deepcopy(canonical_standard_raw_crash)
dumps = {}
processed_crash = {"json_dump": {}}
processed_crash = {}
processor_meta = get_basic_processor_meta()

rule = CrashingThreadInfoRule()
rule.act(raw_crash, dumps, processed_crash, processor_meta)

assert processed_crash == {"json_dump": {}}
assert processed_crash == {}
assert processor_meta["processor_notes"] == []


Expand Down Expand Up @@ -940,7 +940,5 @@ def test_empty_minidump_shortcut(self, tmp_path):

rule.act(raw_crash, dumps, processed_crash, processor_meta)

assert processed_crash["mdsw_return_code"] == 0
assert processed_crash["mdsw_status_string"] == "EmptyMinidump"
assert processed_crash["success"] is True
assert processed_crash["mdsw_stderr"] == "Shortcut for 0-bytes minidump."

0 comments on commit 22eea03

Please sign in to comment.