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
--- 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);
}