Bug 1353168 - Add a crash annotation to distinguish between web, file and extension content processes; r=bsmedberg
authorGabriele Svelto <gsvelto@mozilla.com>
Thu, 01 Jun 2017 11:16:11 +0200
changeset 412766 9d26051a28ea4bffdc654357855f50c9a685fbcc
parent 412765 81e0a353d2dc82c8ea71a5dc26956f292a867895
child 412767 69601a67ea2cd87b175e58afa106eccb16596c70
push id1490
push usermtabara@mozilla.com
push dateMon, 31 Jul 2017 14:08:16 +0000
treeherdermozilla-release@70e32e6bf15e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1353168
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1353168 - Add a crash annotation to distinguish between web, file and extension content processes; r=bsmedberg This adds the RemoteType annotation to a content crash report so that we can distinguish between content processes that crashed while running remote, local or extension code. The annotation is passed along the others to Socorro by the crashreporter and is also whitelisted for inclusion in the crash ping. MozReview-Commit-ID: 4avo0IWfMGf
dom/ipc/ContentChild.cpp
toolkit/components/crashes/CrashManager.jsm
toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
toolkit/components/telemetry/docs/data/crash-ping.rst
toolkit/crashreporter/client/ping.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1500,16 +1500,18 @@ ContentChild::RecvSetProcessSandbox(cons
     sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
 #if defined(XP_LINUX) && !defined(OS_ANDROID)
   nsAutoCString flagsString;
   flagsString.AppendInt(SandboxInfo::Get().AsInteger());
 
   CrashReporter::AnnotateCrashReport(
     NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
 #endif /* XP_LINUX && !OS_ANDROID */
+  CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("RemoteType"),
+                                     NS_ConvertUTF16toUTF8(GetRemoteType()));
 #endif /* MOZ_CRASHREPORTER */
 #endif /* MOZ_CONTENT_SANDBOX */
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -225,16 +225,17 @@ this.CrashManager.prototype = Object.fre
   // A whitelist of crash annotations which do not contain sensitive data
   // and are saved in the crash record and sent with Firefox Health Report.
   ANNOTATION_WHITELIST: [
     "AsyncShutdownTimeout",
     "BuildID",
     "ProductID",
     "ProductName",
     "ReleaseChannel",
+    "RemoteType",
     "SecondsSinceLastCrash",
     "ShutdownProgress",
     "StartupCrash",
     "TelemetryEnvironment",
     "Version",
     // The following entries are not normal annotations that can be found in
     // the .extra file but are included in the crash record/FHR:
     "AvailablePageFile",
--- a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
+++ b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
@@ -477,18 +477,20 @@ add_task(async function test_child_proce
   ];
 
   let ac = new TelemetryArchiveTesting.Checker();
   await ac.promiseInit();
 
   // Add a child-process crash for each allowed process type.
   for (let p of EXPECTED_PROCESSES) {
     // Generate a ping.
+    const remoteType = (p === m.PROCESS_TYPE_CONTENT) ? "web" : undefined;
     let id = await m.createDummyDump();
     await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {
+      RemoteType: remoteType,
       StackTraces: stackTraces,
       MinidumpSha256Hash: sha256Hash,
       ThisShouldNot: "end-up-in-the-ping"
     });
     await m._pingPromise;
 
     let found = await ac.promiseFindPing("crash", [
       [["payload", "crashId"], id],
@@ -500,16 +502,18 @@ add_task(async function test_child_proce
 
     let hoursOnly = new Date(DUMMY_DATE);
     hoursOnly.setSeconds(0);
     hoursOnly.setMinutes(0);
     Assert.equal(new Date(found.payload.crashTime).getTime(), hoursOnly.getTime());
 
     Assert.equal(found.payload.metadata.ThisShouldNot, undefined,
                  "Non-whitelisted fields should be filtered out");
+    Assert.equal(found.payload.metadata.RemoteType, remoteType,
+                 "RemoteType should be whitelisted for content crashes");
   }
 
   // Check that we don't generate a crash ping for invalid/unexpected process
   // types.
   for (let p of UNEXPECTED_PROCESSES) {
     let id = await m.createDummyDump();
     await m.addCrash(p, m.CRASH_TYPE_CRASH, id, DUMMY_DATE, {
       StackTraces: stackTraces,
--- a/toolkit/components/telemetry/docs/data/crash-ping.rst
+++ b/toolkit/components/telemetry/docs/data/crash-ping.rst
@@ -51,16 +51,17 @@ Structure:
           BlockedDllList: <list>, // Windows-only, see WindowsDllBlocklist.cpp for details
           BlocklistInitFailed: 1, // Windows-only, present only if the DLL blocklist initialization failed
           CrashTime: <time>, // Seconds since the Epoch
           ContainsMemoryReport: 1, // Optional
           EventLoopNestingLevel: <levels>, // Optional, present only if >0
           IsGarbageCollecting: 1, // Optional, present only if set to 1
           MozCrashReason: <reason>, // Optional, contains the string passed to MOZ_CRASH()
           OOMAllocationSize: <size>, // Size of the allocation that caused an OOM
+          RemoteType: <type>, // Optional, type of content process, see below for a list of types
           SecondsSinceLastCrash: <duration>, // Seconds elapsed since the last crash occurred
           SystemMemoryUsePercentage: <percentage>, // Windows-only, percent of memory in use
           TelemetrySessionId: <id>, // Active telemetry session ID when the crash was recorded
           TextureUsage: <usage>, // Optional, usage of texture memory in bytes
           TotalPageFile: <size>, // Windows-only, paging file in use
           TotalPhysicalMemory: <size>, // Windows-only, physical memory in use
           TotalVirtualMemory: <size>, // Windows-only, virtual memory in use
           UptimeTS: <duration>, // Seconds since Firefox was started
@@ -87,16 +88,33 @@ are sent only for the ones below:
 +===============+===================================================+
 | main          | Main process, also known as the browser process   |
 +---------------+---------------------------------------------------+
 | content       | Content process                                   |
 +---------------+---------------------------------------------------+
 | gpu           | GPU process                                       |
 +---------------+---------------------------------------------------+
 
+Remote Process Types
+--------------------
+
+The optional ``remoteType`` field contains the type of the content process that
+crashed. As such it is present only if ``processType`` contains the ``content``
+value. The following content process types are currently defined:
+
++-----------+--------------------------------------------------------+
+| Type      | Description                                            |
++===========+========================================================+
+| web       | The content process was running code from a web page   |
++-----------+--------------------------------------------------------+
+| file      | The content process was running code from a local file |
++-----------+--------------------------------------------------------+
+| extension | The content process was running code from an extension |
++-----------+--------------------------------------------------------+
+
 Stack Traces
 ------------
 
 The crash ping may contain a ``stackTraces`` field which has been populated
 with stack traces for all threads in the crashed process. The format of this
 field is similar to the one used by Socorro for representing a crash. The main
 differences are that redundant fields are not stored and that the module a
 frame belongs to is referenced by index in the module array rather than by its
--- a/toolkit/crashreporter/client/ping.cpp
+++ b/toolkit/crashreporter/client/ping.cpp
@@ -132,16 +132,17 @@ CreateMetadataNode(StringTable& strings)
     "CrashTime",
     "EventLoopNestingLevel",
     "IsGarbageCollecting",
     "MozCrashReason",
     "OOMAllocationSize",
     "ProductID",
     "ProductName",
     "ReleaseChannel",
+    "RemoteType",
     "SecondsSinceLastCrash",
     "StartupCrash",
     "SystemMemoryUsePercentage",
     "TelemetrySessionId",
     "TextureUsage",
     "TotalPageFile",
     "TotalPhysicalMemory",
     "TotalVirtualMemory",