Bug 1755375 - Don't generate crash reports when android kills the GPU process. r=agi

If the android system kills the GPU process then ChildCrashHandler.jsm
gets invoked but an empty dump ID. Currently we generate a crash
report anyway, which is resulting in lots of "EMPTY: no crashing
thread identified; ERROR_NO_MINIDUMP_HEADER" crashes.

Instead, we should return early before starting the crash reporter if
the dump ID is empty. We already do this for content processes, so
this patch makes us do so for every type of process.

Differential Revision: https://phabricator.services.mozilla.com/D138766
This commit is contained in:
Jamie Nicol 2022-02-15 20:26:12 +00:00
Родитель 28290f66db
Коммит cce5174d73
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -12,6 +12,7 @@ import org.junit.runner.RunWith
import org.mozilla.geckoview.BuildConfig
import org.mozilla.geckoview.GeckoRuntime
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.IgnoreCrash
import org.mozilla.geckoview.test.util.UiThreadUtils
@RunWith(AndroidJUnit4::class)
@ -41,6 +42,21 @@ class GpuCrashTest : BaseSessionTest() {
assertTrue(evalResult.mMsg, evalResult.mResult)
}
@Test(expected = UiThreadUtils.TimeoutException::class)
fun killGpuNoCrashReport() {
// We need the crash reporter for this test
assumeTrue(BuildConfig.MOZ_CRASHREPORTER)
// We need the GPU process for this test
assumeTrue(sessionRule.usingGpuProcess())
// Cleanly kill GPU process
sessionRule.killGpuProcess()
// Expect this to time out as no crash should be reported
client.getEvalResult(sessionRule.env.defaultTimeoutMillis)
}
@After
fun teardown() {
client.disconnect()

Просмотреть файл

@ -39,6 +39,13 @@ function getPendingMinidump(id) {
var ChildCrashHandler = {
// The event listener for this is hooked up in GeckoViewStartup.jsm
observe(aSubject, aTopic, aData) {
if (
aTopic !== "ipc:content-shutdown" &&
aTopic !== "compositor:process-aborted"
) {
return;
}
aSubject.QueryInterface(Ci.nsIPropertyBag2);
const disableReporting = Cc["@mozilla.org/process/environment;1"]
@ -53,8 +60,10 @@ var ChildCrashHandler = {
return;
}
// If dumpID is empty the process was likely killed by the system and we therefore do not want
// to report the crash.
const dumpID = aSubject.get("dumpID");
if (aTopic === "ipc:content-shutdown" && !dumpID) {
if (!dumpID) {
Services.telemetry
.getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE")
.add(1);