Skip to content

Commit

Permalink
Backed out 2 changesets (bug 1726804) for causing sm bustages in geck…
Browse files Browse the repository at this point in the history
…oprocesstypes.

CLOSED TREE

Backed out changeset bf7f73fd1921 (bug 1726804)
Backed out changeset c9936f7534cb (bug 1726804)
  • Loading branch information
Alexandru Michis committed Nov 19, 2021
1 parent b331541 commit 73e1f5e
Show file tree
Hide file tree
Showing 32 changed files with 595 additions and 1,185 deletions.
3 changes: 0 additions & 3 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,5 @@ tools/update-packaging/**/*refs.js
# Ignore backgroundtasks preferences files.
toolkit/components/backgroundtasks/defaults

# Uses preprocessing
toolkit/components/crashes/CrashManager.jsm

# Ignore pre-generated webpack and typescript transpiled files for translations
browser/extensions/translations/extension/
1 change: 0 additions & 1 deletion build/common_virtualenv_packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,4 @@ pth:toolkit/components/telemetry/tests/marionette/harness
pth:tools
pth:tools/moztreedocs
pth:xpcom/ds/tools
pth:xpcom/geckoprocesstypes_generator
pth:xpcom/idl-parser
69 changes: 37 additions & 32 deletions dom/base/ChromeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -864,20 +864,17 @@ static WebIDLProcType ProcTypeToWebIDL(mozilla::ProcType aType) {
PROCTYPE_TO_WEBIDL_CASE(WebCOOPCOEP, WithCoopCoep);
PROCTYPE_TO_WEBIDL_CASE(WebServiceWorker, WebServiceWorker);
PROCTYPE_TO_WEBIDL_CASE(WebLargeAllocation, WebLargeAllocation);
#define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
process_bin_type, procinfo_typename, \
webidl_typename, allcaps_name) \
PROCTYPE_TO_WEBIDL_CASE(procinfo_typename, webidl_typename);
#define SKIP_PROCESS_TYPE_CONTENT
#ifndef MOZ_ENABLE_FORKSERVER
# define SKIP_PROCESS_TYPE_FORKSERVER
#endif // MOZ_ENABLE_FORKSERVER
#include "mozilla/GeckoProcessTypes.h"
#undef SKIP_PROCESS_TYPE_CONTENT
#ifndef MOZ_ENABLE_FORKSERVER
# undef SKIP_PROCESS_TYPE_FORKSERVER
#endif // MOZ_ENABLE_FORKSERVER
#undef GECKO_PROCESS_TYPE
PROCTYPE_TO_WEBIDL_CASE(Browser, Browser);
PROCTYPE_TO_WEBIDL_CASE(IPDLUnitTest, IpdlUnitTest);
PROCTYPE_TO_WEBIDL_CASE(GMPlugin, GmpPlugin);
PROCTYPE_TO_WEBIDL_CASE(GPU, Gpu);
PROCTYPE_TO_WEBIDL_CASE(VR, Vr);
PROCTYPE_TO_WEBIDL_CASE(RDD, Rdd);
PROCTYPE_TO_WEBIDL_CASE(Socket, Socket);
PROCTYPE_TO_WEBIDL_CASE(RemoteSandboxBroker, RemoteSandboxBroker);
#ifdef MOZ_ENABLE_FORKSERVER
PROCTYPE_TO_WEBIDL_CASE(ForkServer, ForkServer);
#endif
PROCTYPE_TO_WEBIDL_CASE(Preallocated, Preallocated);
PROCTYPE_TO_WEBIDL_CASE(Unknown, Unknown);
}
Expand Down Expand Up @@ -948,28 +945,36 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
// These processes are handled separately.
return;
}
#define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
process_bin_type, procinfo_typename, \
webidl_typename, allcaps_name) \
case GeckoProcessType::GeckoProcessType_##enum_name: { \
type = mozilla::ProcType::procinfo_typename; \
break; \
}
#define SKIP_PROCESS_TYPE_CONTENT
#ifndef MOZ_ENABLE_FORKSERVER
# define SKIP_PROCESS_TYPE_FORKSERVER
#endif // MOZ_ENABLE_FORKSERVER
#include "mozilla/GeckoProcessTypes.h"
#ifndef MOZ_ENABLE_FORKSERVER
# undef SKIP_PROCESS_TYPE_FORKSERVER
#endif // MOZ_ENABLE_FORKSERVER
#undef SKIP_PROCESS_TYPE_CONTENT
#undef GECKO_PROCESS_TYPE
case GeckoProcessType::GeckoProcessType_Default:
type = mozilla::ProcType::Browser;
break;
case GeckoProcessType::GeckoProcessType_GMPlugin:
type = mozilla::ProcType::GMPlugin;
break;
case GeckoProcessType::GeckoProcessType_GPU:
type = mozilla::ProcType::GPU;
break;
case GeckoProcessType::GeckoProcessType_VR:
type = mozilla::ProcType::VR;
break;
case GeckoProcessType::GeckoProcessType_RDD:
type = mozilla::ProcType::RDD;
break;
case GeckoProcessType::GeckoProcessType_Socket:
type = mozilla::ProcType::Socket;
break;
case GeckoProcessType::GeckoProcessType_RemoteSandboxBroker:
type = mozilla::ProcType::RemoteSandboxBroker;
break;
#ifdef MOZ_ENABLE_FORKSERVER
case GeckoProcessType::GeckoProcessType_ForkServer:
type = mozilla::ProcType::ForkServer;
break;
#endif
default:
// Leave the default Unknown value in |type|.
break;
}

requests.EmplaceBack(
/* aPid = */ childPid,
/* aProcessType = */ type,
Expand Down
47 changes: 42 additions & 5 deletions ipc/glue/CrashReporterHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,44 @@
#include "nsXULAppAPI.h"
#include "nsIFile.h"

// Consistency checking for nsICrashService constants. We depend on the
// equivalence between nsICrashService values and GeckoProcessType values
// in the code below. Making them equal also ensures that if new process
// types are added, people will know they may need to add crash reporting
// support in various places because compilation errors will be triggered here.
static_assert(nsICrashService::PROCESS_TYPE_MAIN ==
(int)GeckoProcessType_Default,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_CONTENT ==
(int)GeckoProcessType_Content,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_IPDLUNITTEST ==
(int)GeckoProcessType_IPDLUnitTest,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_GMPLUGIN ==
(int)GeckoProcessType_GMPlugin,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_GPU == (int)GeckoProcessType_GPU,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_VR == (int)GeckoProcessType_VR,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_RDD == (int)GeckoProcessType_RDD,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_SOCKET ==
(int)GeckoProcessType_Socket,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_SANDBOX_BROKER ==
(int)GeckoProcessType_RemoteSandboxBroker,
"GeckoProcessType enum is out of sync with nsICrashService!");
static_assert(nsICrashService::PROCESS_TYPE_FORKSERVER ==
(int)GeckoProcessType_ForkServer,
"GeckoProcessType enum is out of sync with nsICrashService!");
// Add new static asserts here if you add more process types.
// Update this static assert as well.
static_assert(nsICrashService::PROCESS_TYPE_FORKSERVER + 1 ==
(int)GeckoProcessType_End,
"GeckoProcessType enum is out of sync with nsICrashService!");

namespace mozilla {
namespace ipc {

Expand Down Expand Up @@ -102,11 +140,10 @@ void CrashReporterHost::RecordCrashWithTelemetry(GeckoProcessType aProcessType,
nsCString key;

switch (aProcessType) {
#define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, proc_typename, \
process_bin_type, procinfo_typename, \
webidl_typename, allcaps_name) \
case GeckoProcessType_##enum_name: \
key.AssignLiteral(string_name); \
#define GECKO_PROCESS_TYPE(enum_value, enum_name, string_name, xre_name, \
bin_type) \
case GeckoProcessType_##enum_name: \
key.AssignLiteral(string_name); \
break;
#include "mozilla/GeckoProcessTypes.h"
#undef GECKO_PROCESS_TYPE
Expand Down
6 changes: 0 additions & 6 deletions python/mozbuild/mozbuild/action/test_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,6 @@
"pattern": "**",
"dest": "tools/mozterm",
},
{
"source": buildconfig.topsrcdir,
"base": "xpcom/geckoprocesstypes_generator",
"pattern": "**",
"dest": "tools/geckoprocesstypes_generator",
},
{
"source": buildconfig.topsrcdir,
"base": "third_party/python/six",
Expand Down
1 change: 0 additions & 1 deletion testing/config/mozbase_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
../tools/mozterm
../tools/geckoprocesstypes_generator

../mozbase/manifestparser
../mozbase/mozcrash
Expand Down
1 change: 0 additions & 1 deletion testing/config/mozbase_source_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
--editable ../../python/mozterm
--editable ../../xpcom/geckoprocesstypes_generator

--editable ../mozbase/manifestparser
--editable ../mozbase/mozcrash
Expand Down
13 changes: 9 additions & 4 deletions testing/mozbase/mozleak/mozleak/leaklog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import os
import re

from geckoprocesstypes import process_types


def _get_default_logger():
from mozlog import get_default_logger
Expand Down Expand Up @@ -185,9 +183,16 @@ def process_leak_log(

# This list is based on XRE_GeckoProcessTypeToString. ipdlunittest processes likely
# are not going to produce leak logs we will ever see.

knownProcessTypes = [
p.string_name for p in process_types if p.string_name != "ipdlunittest"
"default",
"forkserver",
"gmplugin",
"gpu",
"plugin",
"rdd",
"socket",
"tab",
"vr",
]

for processType in knownProcessTypes:
Expand Down
1 change: 0 additions & 1 deletion testing/tools/mach_test_package_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"reftest",
"tools/mach",
"tools/mozterm",
"tools/geckoprocesstypes_generator",
"tools/six",
"tools/wptserve",
"web-platform",
Expand Down
84 changes: 30 additions & 54 deletions toolkit/components/crashes/CrashManager.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,26 @@ var CrashManager = function(options) {
};

CrashManager.prototype = Object.freeze({
#includesubst @OBJDIR@/GeckoProcessTypes_CrashManager_map.js
// A crash in the main process.
PROCESS_TYPE_MAIN: "main",

// A crash in a content process.
PROCESS_TYPE_CONTENT: "content",

// A crash in a Gecko media plugin process.
PROCESS_TYPE_GMPLUGIN: "gmplugin",

// A crash in the GPU process.
PROCESS_TYPE_GPU: "gpu",

// A crash in the VR process.
PROCESS_TYPE_VR: "vr",

// A crash in the RDD process.
PROCESS_TYPE_RDD: "rdd",

// A crash in the socket process.
PROCESS_TYPE_SOCKET: "socket",

// A real crash.
CRASH_TYPE_CRASH: "crash",
Expand Down Expand Up @@ -452,8 +471,13 @@ CrashManager.prototype = Object.freeze({
deferred.resolve();
}

// Send a telemetry ping for each non-main process crash
if (
this.isValidProcessType(processType) && this.isPingAllowed(processType)
processType === this.PROCESS_TYPE_CONTENT ||
processType === this.PROCESS_TYPE_GPU ||
processType === this.PROCESS_TYPE_VR ||
processType === this.PROCESS_TYPE_RDD ||
processType === this.PROCESS_TYPE_SOCKET
) {
this._sendCrashPing(id, processType, date, metadata);
}
Expand All @@ -462,48 +486,6 @@ CrashManager.prototype = Object.freeze({
return promise;
},

/**
* Check that the processType parameter is a valid one:
* - it is a string
* - it is listed in this.processTypes
*
* @param processType (string) Process type to evaluate
*
* @return boolean True or false depending whether it is a legit one
*/
isValidProcessType(processType) {
if (typeof(processType) !== "string") {
return false;
}

for (const pt of Object.values(this.processTypes)) {
if (pt === processType) {
return true;
}
}

return false;
},

/**
* Check that processType is allowed to send a ping
*
* @param processType (string) Process type to check for
*
* @return boolean True or False depending on whether ping is allowed
**/
isPingAllowed(processType) {
#includesubst @OBJDIR@/GeckoProcessTypes_CrashManager_pings.js

// Should not even reach this because of isValidProcessType() but just in
// case we try to be cautious
if (!(processType in processPings)) {
return false;
}

return processPings[processType];
},

/**
* Returns a promise that is resolved only the crash with the specified id
* has been fully recorded.
Expand Down Expand Up @@ -745,7 +727,7 @@ CrashManager.prototype = Object.freeze({
let crashID = lines[0];
let metadata = JSON.parse(lines[1]);
store.addCrash(
this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
this.PROCESS_TYPE_MAIN,
this.CRASH_TYPE_CRASH,
crashID,
date,
Expand All @@ -756,7 +738,7 @@ CrashManager.prototype = Object.freeze({
// If CrashPingUUID is not present then a ping was not generated
// by the crashreporter for this crash so we need to send one from
// here.
this._sendCrashPing(crashID, this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT], date, metadata);
this._sendCrashPing(crashID, this.PROCESS_TYPE_MAIN, date, metadata);
}

break;
Expand All @@ -765,7 +747,7 @@ CrashManager.prototype = Object.freeze({
if (lines.length == 3) {
let [crashID, result, remoteID] = lines;
store.addCrash(
this.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT],
this.PROCESS_TYPE_MAIN,
this.CRASH_TYPE_CRASH,
crashID,
date
Expand Down Expand Up @@ -1304,7 +1286,7 @@ CrashStore.prototype = Object.freeze({

if (
count > this.HIGH_WATER_DAILY_THRESHOLD &&
processType != CrashManager.prototype.processTypes[Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT]
processType != CrashManager.prototype.PROCESS_TYPE_MAIN
) {
return null;
}
Expand Down Expand Up @@ -1369,12 +1351,6 @@ CrashStore.prototype = Object.freeze({
return true;
},

/**
* @param processType (string) One of the PROCESS_TYPE constants.
* @param crashType (string) One of the CRASH_TYPE constants.
*
* @return array of crashes
*/
getCrashesOfType(processType, crashType) {
let crashes = [];
for (let crash of this.crashes) {
Expand Down
Loading

0 comments on commit 73e1f5e

Please sign in to comment.