bug 1398431 - Don't let off-thread CCs get you down r?Dexter draft
authorChris H-C <chutten@mozilla.com>
Wed, 13 Sep 2017 10:44:22 -0400
changeset 663970 5345b591402a9e2454f76ad99eaf7a9fe5707155
parent 663134 a73cc4e08bf5a005722c95b43f84ab0c8ff2bc7c
child 731325 7bb26dc1068041db8ea4f2d8ecd87e862953d7b0
push id79569
push userbmo:chutten@mozilla.com
push dateWed, 13 Sep 2017 14:46:40 +0000
reviewersDexter
bugs1398431
milestone57.0a1
bug 1398431 - Don't let off-thread CCs get you down r?Dexter Since we don't atomically retrieve session and subsession snapshots, there's a possibility that off-thread accumulations can happen in between the two getPayload calls in test_checkSubsessionHistograms. CYCLE_COLLECTOR_WORKER* are the obvious first choice. MozReview-Commit-ID: 5lseRAJ1Rg6
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -768,23 +768,33 @@ add_task(async function test_checkSubses
 
   const stableKeyedHistograms = new Set([
     "TELEMETRY_TEST_KEYED_FLAG",
     "TELEMETRY_TEST_KEYED_COUNT",
     "TELEMETRY_TEST_KEYED_RELEASE_OPTIN",
     "TELEMETRY_TEST_KEYED_RELEASE_OPTOUT",
   ]);
 
+  // List of prefixes of histograms that could anomalously be present in
+  // the subsession snapshot but not the session snapshot.
+  // If you add something to this list, please reference a bug#
+  const possibleAnomalyPrefixes = [
+    "CYCLE_COLLECTOR_WORKER", // non-MT CC can happen between payload gathering - bug 1398431
+  ];
+
   // Compare the two sets of histograms.
   // The "subsession" histograms should match the registered
   // "classic" histograms. However, histograms can change
   // between us collecting the different payloads, so we only
   // check for deep equality on known stable histograms.
   let checkHistograms = (classic, subsession, message) => {
     for (let id of Object.keys(subsession)) {
+      if (possibleAnomalyPrefixes.some(prefix => id.startsWith(prefix))) {
+        continue;
+      }
       Assert.ok(id in classic, message + ` (${id})`);
       if (stableHistograms.has(id)) {
         Assert.deepEqual(classic[id],
                          subsession[id], message);
       } else {
         Assert.equal(classic[id].histogram_type,
                      subsession[id].histogram_type, message);
       }