Backed out 3 changesets (bug 994707) for Valgrind and XPCShell bustage on a CLOSED TREE

Backed out changeset 76555f34c210 (bug 994707)
Backed out changeset 3dd92fb7c846 (bug 994707)
Backed out changeset 802779efce2b (bug 994707)
This commit is contained in:
Wes Kocher 2014-07-01 11:04:30 -07:00
parent 7760c34661
commit 4c1c6bcbf5
9 changed files with 27 additions and 314 deletions

View File

@ -1073,35 +1073,6 @@ org.mozilla.crashes.crashes
This measurement contains a historical record of application crashes.
Version 4
^^^^^^^^^
This version follows up from version 3, adding submissions which are now
tracked by the :ref:`crashes_crashmanager`.
This measurement will be reported on each day there was a crash or crash
submission. Records may contain the following fields, whose values indicate
the number of crashes, hangs, or submissions that occurred on the given day:
* main-crash
* main-crash-submission-succeeded
* main-crash-submission-failed
* main-hang
* main-hang-submission-succeeded
* main-hang-submission-failed
* content-crash
* content-crash-submission-succeeded
* content-crash-submission-failed
* content-hang
* content-hang-submission-succeeded
* content-hang-submission-failed
* plugin-crash
* plugin-crash-submission-succeeded
* plugin-crash-submission-failed
* plugin-hang
* plugin-hang-submission-succeeded
* plugin-hang-submission-failed
Version 3
^^^^^^^^^
@ -1181,14 +1152,6 @@ Example
"_v": 2,
"mainCrash": 2
}
"org.mozilla.crashes.crashes": {
"_v": 4,
"main-crash": 2,
"main-crash-submission-succeeded": 1,
"main-crash-submission-failed": 1,
"main-hang": 1,
"plugin-crash": 2
}
org.mozilla.healthreport.submissions
------------------------------------

View File

@ -1047,38 +1047,6 @@ DailyCrashesMeasurement3.prototype = Object.freeze({
},
});
function DailyCrashesMeasurement4() {
Metrics.Measurement.call(this);
}
DailyCrashesMeasurement4.prototype = Object.freeze({
__proto__: Metrics.Measurement.prototype,
name: "crashes",
version: 4,
fields: {
"main-crash": DAILY_LAST_NUMERIC_FIELD,
"main-crash-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"main-crash-submission-failed": DAILY_LAST_NUMERIC_FIELD,
"main-hang": DAILY_LAST_NUMERIC_FIELD,
"main-hang-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"main-hang-submission-failed": DAILY_LAST_NUMERIC_FIELD,
"content-crash": DAILY_LAST_NUMERIC_FIELD,
"content-crash-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"content-crash-submission-failed": DAILY_LAST_NUMERIC_FIELD,
"content-hang": DAILY_LAST_NUMERIC_FIELD,
"content-hang-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"content-hang-submission-failed": DAILY_LAST_NUMERIC_FIELD,
"plugin-crash": DAILY_LAST_NUMERIC_FIELD,
"plugin-crash-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"plugin-crash-submission-failed": DAILY_LAST_NUMERIC_FIELD,
"plugin-hang": DAILY_LAST_NUMERIC_FIELD,
"plugin-hang-submission-succeeded": DAILY_LAST_NUMERIC_FIELD,
"plugin-hang-submission-failed": DAILY_LAST_NUMERIC_FIELD,
},
});
this.CrashesProvider = function () {
Metrics.Provider.call(this);
@ -1095,7 +1063,6 @@ CrashesProvider.prototype = Object.freeze({
DailyCrashesMeasurement1,
DailyCrashesMeasurement2,
DailyCrashesMeasurement3,
DailyCrashesMeasurement4,
],
pullOnly: true,
@ -1108,8 +1075,8 @@ CrashesProvider.prototype = Object.freeze({
this._log.info("Grabbing crash counts from crash manager.");
let crashCounts = yield this._manager.getCrashCountsByDay();
let m = this.getMeasurement("crashes", 4);
let fields = DailyCrashesMeasurement4.prototype.fields;
let m = this.getMeasurement("crashes", 3);
let fields = DailyCrashesMeasurement3.prototype.fields;
for (let [day, types] of crashCounts) {
let date = Metrics.daysToDate(day);

View File

@ -130,21 +130,12 @@ this.CrashManager.prototype = Object.freeze({
// A crash in a plugin process.
PROCESS_TYPE_PLUGIN: "plugin",
// A submission of a crash.
PROCESS_TYPE_SUBMISSION: "submission",
// A real crash.
CRASH_TYPE_CRASH: "crash",
// A hang.
CRASH_TYPE_HANG: "hang",
// A successful submission.
SUBMISSION_TYPE_SUCCEEDED: "succeeded",
// A failed submission.
SUBMISSION_TYPE_FAILED: "failed",
DUMP_REGEX: /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.dmp$/i,
SUBMITTED_REGEX: /^bp-(?:hr-)?([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})\.txt$/i,
ALL_REGEX: /^(.*)$/,
@ -369,38 +360,6 @@ this.CrashManager.prototype = Object.freeze({
}.bind(this));
},
/**
* Record the occurrence of a crash submission.
*
* @param processType (string) One of the PROCESS_TYPE constants.
* @param crashType (string) One of the CRASH_TYPE constants.
* @param succeeded (boolean) Whether the submission succeeded.
* @param id (string) Crash ID. Likely a UUID.
* @param date (Date) When the crash occurred.
*
* @return boolean True if the crash submission was recorded and false if not.
*/
addSubmission: function (processType, crashType, succeeded, id, date) {
return Task.spawn(function* () {
let store = yield this._getStore();
if (this._addSubmissionAsCrash(store, processType, crashType, succeeded,
id, date)) {
yield store.save();
}
}.bind(this));
},
_addSubmissionAsCrash: function (store, processType, crashType, succeeded,
id, date) {
let id = id + "-" + this.PROCESS_TYPE_SUBMISSION;
let process = processType + "-" + crashType + "-" +
this.PROCESS_TYPE_SUBMISSION;
let submission_type = (
succeeded ? this.SUBMISSION_TYPE_SUCCEEDED : this.SUBMISSION_TYPE_FAILED);
return store.addCrash(process, submission_type, id, date);
},
/**
* Obtain the paths of all unprocessed events files.
*
@ -466,35 +425,27 @@ this.CrashManager.prototype = Object.freeze({
// The payload types and formats are documented in docs/crash-events.rst.
// Do not change the format of an existing type. Instead, invent a new
// type.
// DO NOT ADD NEW TYPES WITHOUT DOCUMENTING!
let lines = payload.split("\n");
switch (type) {
case "crash.main.1":
if (lines.length > 1) {
this._log.warn("Multiple lines unexpected in payload for " +
entry.path);
return this.EVENT_FILE_ERROR_MALFORMED;
}
store.addCrash(this.PROCESS_TYPE_MAIN, this.CRASH_TYPE_CRASH,
payload, date);
break;
// type in event file => [processType, crashType]
let eventMap = {
"crash.main.1": ["main", "crash"],
};
case "crash.submission.1":
if (lines.length == 3) {
this._addSubmissionAsCrash(store, this.PROCESS_TYPE_MAIN,
this.CRASH_TYPE_CRASH,
lines[1] === "true", lines[0], date);
} else {
return this.EVENT_FILE_ERROR_MALFORMED;
}
break;
if (type in eventMap) {
let lines = payload.split("\n");
if (lines.length > 1) {
this._log.warn("Multiple lines unexpected in payload for " +
entry.path);
return this.EVENT_FILE_ERROR_MALFORMED;
}
default:
return this.EVENT_FILE_ERROR_UNKNOWN_EVENT;
store.addCrash(...eventMap[type], payload, date);
return this.EVENT_FILE_SUCCESS;
}
return this.EVENT_FILE_SUCCESS;
// DO NOT ADD NEW TYPES WITHOUT DOCUMENTING!
return this.EVENT_FILE_ERROR_UNKNOWN_EVENT;
},
/**

View File

@ -74,18 +74,6 @@ The payload of this event is the string crash ID, very likely a UUID.
There should be ``UUID.dmp`` and ``UUID.extra`` files on disk, saved by
Breakpad.
crash.submission.1
^^^^^^^^^^^^
This event is produced when a crash is submitted.
The payload of this event is delimited by UNIX newlines (*\n*) and contains the
following fields:
* The crash ID string
* "true" if the submission succeeded or "false" otherwise
* The remote crash ID string if the submission succeeded
Aggregated Event Log
====================

View File

@ -304,42 +304,3 @@ add_task(function* test_addCrash() {
Assert.equal(crash.type, m.PROCESS_TYPE_PLUGIN + "-" + m.CRASH_TYPE_HANG);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_HANG));
});
add_task(function* test_addSubmission() {
let m = yield getManager();
let crashes = yield m.getCrashes();
Assert.equal(crashes.length, 0);
yield m.addSubmission(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH, true,
"success", DUMMY_DATE);
yield m.addSubmission(m.PROCESS_TYPE_MAIN, m.CRASH_TYPE_CRASH, false,
"failure", DUMMY_DATE);
crashes = yield m.getCrashes();
Assert.equal(crashes.length, 2);
let map = new Map(crashes.map(crash => [crash.id, crash]));
let crash = map.get("success-submission");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE);
Assert.equal(crash.type,
m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH + "-" +
m.PROCESS_TYPE_SUBMISSION + "-" + m.SUBMISSION_TYPE_SUCCEEDED);
Assert.ok(
crash.isOfType(m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH + "-" +
m.PROCESS_TYPE_SUBMISSION, m.SUBMISSION_TYPE_SUCCEEDED));
let crash = map.get("failure-submission");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE);
Assert.equal(crash.type,
m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH + "-" +
m.PROCESS_TYPE_SUBMISSION + "-" + m.SUBMISSION_TYPE_FAILED);
Assert.ok(
crash.isOfType(m.PROCESS_TYPE_MAIN + "-" + m.CRASH_TYPE_CRASH + "-" +
m.PROCESS_TYPE_SUBMISSION, m.SUBMISSION_TYPE_FAILED));
});

View File

@ -17,11 +17,8 @@ const {
PROCESS_TYPE_MAIN,
PROCESS_TYPE_CONTENT,
PROCESS_TYPE_PLUGIN,
PROCESS_TYPE_SUBMISSION,
CRASH_TYPE_CRASH,
CRASH_TYPE_HANG,
SUBMISSION_TYPE_SUCCEEDED,
SUBMISSION_TYPE_FAILED,
} = CrashManager.prototype;
const CrashStore = bsp.CrashStore;
@ -276,44 +273,6 @@ add_task(function* test_add_plugin_hang() {
Assert.equal(crashes.length, 2);
});
add_task(function* test_add_submission() {
let s = yield getStore();
Assert.ok(
s.addCrash(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH + "-" +
PROCESS_TYPE_SUBMISSION, SUBMISSION_TYPE_SUCCEEDED,
"id1", new Date())
);
Assert.equal(s.crashesCount, 1);
let c = s.crashes[0];
Assert.ok(c.crashDate);
Assert.equal(c.type, PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH + "-" +
PROCESS_TYPE_SUBMISSION + "-" + SUBMISSION_TYPE_SUCCEEDED);
Assert.ok(c.isOfType(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH + "-" +
PROCESS_TYPE_SUBMISSION, SUBMISSION_TYPE_SUCCEEDED));
Assert.ok(
s.addCrash(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH + "-" +
PROCESS_TYPE_SUBMISSION, SUBMISSION_TYPE_FAILED,
"id2", new Date())
);
Assert.equal(s.crashesCount, 2);
// Duplicate.
Assert.ok(
s.addCrash(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH + "-" +
PROCESS_TYPE_SUBMISSION, SUBMISSION_TYPE_SUCCEEDED,
"id1", new Date())
);
Assert.equal(s.crashesCount, 2);
let crashes = s.getCrashesOfType(PROCESS_TYPE_MAIN + "-" + CRASH_TYPE_CRASH +
"-" + PROCESS_TYPE_SUBMISSION,
SUBMISSION_TYPE_SUCCEEDED);
Assert.equal(crashes.length, 1);
});
add_task(function* test_add_mixed_types() {
let s = yield getStore();

View File

@ -32,12 +32,9 @@ namespace CrashReporter {
StringTable gStrings;
string gSettingsPath;
string gEventsPath;
int gArgc;
char** gArgv;
enum SubmissionResult {Succeeded, Failed};
static auto_ptr<ofstream> gLogStream(nullptr);
static string gReporterDumpFile;
static string gExtraFile;
@ -175,53 +172,6 @@ bool WriteStringsToFile(const string& path,
return success;
}
static string Basename(const string& file)
{
string::size_type slashIndex = file.rfind(UI_DIR_SEPARATOR);
if (slashIndex != string::npos)
return file.substr(slashIndex + 1);
else
return file;
}
static string GetDumpLocalID()
{
string localId = Basename(gReporterDumpFile);
string::size_type dot = localId.rfind('.');
if (dot == string::npos)
return "";
return localId.substr(0, dot);
}
static void WriteSubmissionEvent(SubmissionResult result,
const string& remoteId)
{
if (gEventsPath.empty()) {
// If there is no path for writing the submission event, skip it.
return;
}
string localId = GetDumpLocalID();
string fpath = gEventsPath + UI_DIR_SEPARATOR + localId + "-submission";
ofstream* f = UIOpenWrite(fpath.c_str());
time_t tm;
time(&tm);
if (f->is_open()) {
*f << "crash.submission.1\n";
*f << tm << "\n";
*f << localId << "\n";
*f << (result == Succeeded ? "true" : "false") << "\n";
*f << remoteId;
f->close();
}
delete f;
}
void LogMessage(const std::string& message)
{
if (gLogStream.get()) {
@ -268,6 +218,15 @@ static string GetExtraDataFilename(const string& dumpfile)
return filename;
}
static string Basename(const string& file)
{
int slashIndex = file.rfind(UI_DIR_SEPARATOR);
if (slashIndex >= 0)
return file.substr(slashIndex + 1);
else
return file;
}
static bool MoveCrashData(const string& toDir,
string& dumpfile,
string& extrafile)
@ -357,7 +316,6 @@ static bool AddSubmittedReport(const string& serverResponse)
file->close();
delete file;
WriteSubmissionEvent(Succeeded, responseItems["CrashID"]);
return true;
}
@ -385,10 +343,7 @@ void SendCompleted(bool success, const string& serverResponse)
return;
directory.resize(slashpos);
UIPruneSavedDumps(directory);
WriteSubmissionEvent(Failed, "");
}
} else {
WriteSubmissionEvent(Failed, "");
}
}
@ -559,25 +514,6 @@ int main(int argc, char** argv)
OpenLogFile();
#ifdef XP_WIN32
static const wchar_t kEventsDirKey[] = L"MOZ_CRASHREPORTER_EVENTS_DIRECTORY";
const wchar_t *eventsPath = _wgetenv(kEventsDirKey);
if (eventsPath && *eventsPath) {
gEventsPath = WideToUTF8(eventsPath);
}
#else
static const char kEventsDirKey[] = "MOZ_CRASHREPORTER_EVENTS_DIRECTORY";
const char *eventsPath = getenv(kEventsDirKey);
if (eventsPath && *eventsPath) {
gEventsPath = eventsPath;
}
#endif
else {
gEventsPath.clear();
}
gEventsPath.clear();
if (!UIFileExists(gReporterDumpFile)) {
UIError(gStrings[ST_ERROR_DUMPFILEEXISTS]);
return 0;

View File

@ -82,7 +82,6 @@ typedef std::map<std::string, std::string> StringTable;
namespace CrashReporter {
extern StringTable gStrings;
extern std::string gSettingsPath;
extern std::string gEventsPath;
extern int gArgc;
extern char** gArgv;

View File

@ -2107,21 +2107,10 @@ SetCrashEventsDir(nsIFile* aDir)
nsString path;
eventsDir->GetPath(path);
eventsDirectory = reinterpret_cast<wchar_t*>(ToNewUnicode(path));
// Save the path in the environment for the crash reporter application.
nsAutoString eventsDirEnv(NS_LITERAL_STRING("MOZ_CRASHREPORTER_EVENTS_DIRECTORY="));
eventsDirEnv.Append(path);
_wputenv(eventsDirEnv.get());
#else
nsCString path;
eventsDir->GetNativePath(path);
eventsDirectory = ToNewCString(path);
// Save the path in the environment for the crash reporter application.
nsAutoCString eventsDirEnv("MOZ_CRASHREPORTER_EVENTS_DIRECTORY=");
eventsDirEnv.Append(path);
char* eventsEnv = ToNewCString(eventsDirEnv);
PR_SetEnv(eventsEnv);
#endif
}