Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Process crashes from Chrome crash server and find culprits for them.""" | 5 """Process crashes from Chrome crash server and find culprits for them.""" |
| 6 | 6 |
| 7 from common import chromium_deps | |
| 8 from crash import detect_regression_range | |
| 9 from crash import findit_for_crash | |
| 10 from crash.fracas_parser import FracasParser | |
| 7 | 11 |
| 8 def FindCulpritForChromeCrash( # Not implemented yet pylint: disable=W0613 | 12 |
| 9 channel, platform, signature, stack_trace, | 13 def FindCulpritForChromeCrash(signature, platform, |
| 10 crashed_version, versions_to_cpm): | 14 stack_trace, crashed_version, historic_metadata): |
| 11 """Finds culprits for a Chrome crash. | 15 """Finds culprits for a Chrome crash. |
| 12 | 16 |
| 13 Args: | 17 Args: |
| 14 channel (str): The channel name, could be 'dev', 'canary', 'beta', etc. | |
| 15 platform (str): The platform name, could be 'win', 'mac', 'linux', | 18 platform (str): The platform name, could be 'win', 'mac', 'linux', |
| 16 'android', 'ios', etc. | 19 'android', 'ios', etc. |
| 17 signature (str): The signature of a crash on the Chrome crash server. | 20 signature (str): The signature of a crash on the Chrome crash server. |
| 18 stack_trace (str): A string containing the stack trace of a crash. | 21 stack_trace (str): A string containing the stack trace of a crash. |
| 19 crash_version (str): The version of Chrome in which the crash occurred. | 22 crash_version (str): The version of Chrome in which the crash occurred. |
| 20 versions_to_cpm (dict): Mapping from Chrome version to crash per million | 23 historic_metadata (dict): Mapping from Chrome version to historic metadata. |
|
stgao
2016/05/05 17:32:28
Is it still a dict?
Sharu Jiang
2016/05/05 20:26:45
Done.
| |
| 21 page loads. | |
| 22 | 24 |
| 23 Returns: | 25 Returns: |
| 24 (analysis_result_dict, tag_dict) | 26 (analysis_result_dict, tag_dict) |
| 25 The analysis result is a dict like below: | 27 The analysis result is a dict like below: |
| 26 { | 28 { |
| 27 "found": True, # Indicate whether anything is found. | 29 "found": True, # Indicate whether anything is found. |
| 28 "suspected_project_path": "src/v8", # The full path to the dependency. | 30 "suspected_project_path": "src/v8", # The full path to the dependency. |
| 29 "suspected_project_name": "v8", # A project name of the dependency. | 31 "suspected_project_name": "v8", # A project name of the dependency. |
| 30 "components": ["blink>javascript"], # Components to file bug against. | 32 "components": ["blink>javascript"], # Components to file bug against. |
| 31 "culprits": [ | 33 "culprits": [ |
| 32 { | 34 { |
| 33 "url": "https://chromium.googlesource.com/chromium/.../+/hash", | 35 "url": "https://chromium.googlesource.com/chromium/.../+/hash", |
| 34 "revision": "commit-hash", | 36 "revision": "commit-hash", |
| 35 "code_review_url": "https://codereview.chromium.org/ISSUE", | 37 "code_review_url": "https://codereview.chromium.org/ISSUE", |
| 36 "project_path": "src/v8", | 38 "project_path": "src/v8", |
| 37 "project_name": "v8", | |
| 38 "author": "who@chromium.org", | 39 "author": "who@chromium.org", |
| 39 "time": "2015-08-17 03:38:16", # When the revision was committed. | 40 "time": "2015-08-17 03:38:16", # When the revision was committed. |
| 40 "reason": "A plain string with '\n' as line break to explain why", | 41 "reason": "A plain string with '\n' as line break to explain why", |
| 41 "confidence": "0.6", # Optional confidence score. | 42 "confidence": "0.6", # Optional confidence score. |
| 42 }, | 43 }, |
| 43 ], | 44 ], |
| 44 } | 45 } |
| 45 The code review url might not always be available, because not all commits | 46 The code review url might not always be available, because not all commits |
| 46 go through code review. In that case, commit url should be used instead. | 47 go through code review. In that case, commit url should be used instead. |
| 47 | 48 |
| 48 The tag dict are allowed key/value pairs to tag the analysis result for | 49 The tag dict are allowed key/value pairs to tag the analysis result for |
| 49 query and monitoring purpose on Findit side. For allowed keys, please | 50 query and monitoring purpose on Findit side. For allowed keys, please |
| 50 refer to crash_analysis.py and fracas_crash_analysis.py: | 51 refer to crash_analysis.py and fracas_crash_analysis.py: |
| 51 For results with normal culprit-finding algorithm: | 52 For results with normal culprit-finding algorithm: { |
| 52 { | |
| 53 'found_suspects': True, | 53 'found_suspects': True, |
| 54 'has_regression_range': True, | 54 'has_regression_range': True, |
| 55 'solution': 'core_algorithm', | 55 'solution': 'core_algorithm', |
| 56 } | 56 } |
| 57 For results using git blame without a regression range: | 57 For results using git blame without a regression range: { |
| 58 { | |
| 59 'found_suspects': True, | 58 'found_suspects': True, |
| 60 'has_regression_range': False, | 59 'has_regression_range': False, |
| 61 'solution': 'blame', | 60 'solution': 'blame', |
| 62 } | 61 } |
| 63 If nothing is found: | 62 If nothing is found: { |
| 64 { | |
| 65 'found_suspects': False, | 63 'found_suspects': False, |
| 66 } | 64 } |
| 67 """ | 65 """ |
| 68 # TODO (katesonia): hook the analysis logic up here. | 66 crash_deps = chromium_deps.GetChromeDependency(crashed_version, platform) |
| 69 return {'found': False}, {'found_suspects': False} # pragma: no cover. | 67 stacktrace = FracasParser().Parse(stack_trace, crash_deps) |
| 68 | |
| 69 regression_deps_rolls = {} | |
| 70 regression_versions = detect_regression_range.DetectRegressionRange( | |
| 71 historic_metadata) | |
| 72 | |
| 73 if regression_versions: | |
| 74 good_version, bad_version = regression_versions | |
|
Martin Barbella
2016/05/05 16:37:37
How about last_good_version, first_bad_version? Ma
Sharu Jiang
2016/05/05 20:26:45
Done.
| |
| 75 # Get regression deps and crash deps. | |
| 76 regression_deps_rolls = chromium_deps.GetDEPSRollsDict( | |
| 77 good_version, bad_version, platform) | |
| 78 | |
| 79 culprit_results = findit_for_crash.FindItForCrash( | |
| 80 stacktrace, regression_deps_rolls, crash_deps) | |
| 81 | |
| 82 # TODO(katesonia): Enable dependency classifier and component classifier. | |
| 83 suspected_dep = '' | |
| 84 suspected_components = [] | |
| 85 | |
| 86 return ( | |
| 87 { | |
| 88 'found': True, | |
|
Martin Barbella
2016/05/05 16:37:37
Is this correct?
Sharu Jiang
2016/05/05 20:26:45
No, updated it.
| |
| 89 'suspected_dep': suspected_dep, | |
| 90 'suspected_components': suspected_components, | |
| 91 'culprits': culprit_results, | |
| 92 }, | |
| 93 { | |
| 94 'found_suspects': bool(culprit_results), | |
| 95 'has_regression_range': bool(regression_versions), | |
| 96 'solution': 'core_algorithm', | |
|
stgao
2016/05/05 17:32:28
Is it always 'core_algorithm'? What if there is no
Sharu Jiang
2016/05/05 20:26:45
Right now, we don't support the git blame yet beca
stgao
2016/05/05 21:02:46
In that case, if we don't have regression range, s
Sharu Jiang
2016/05/05 23:03:45
In FindItForCrash, we checkout if the regression_d
stgao
2016/05/06 19:11:24
As long as analysis is not run and empty result is
| |
| 97 } | |
| 98 ) | |
| OLD | NEW |