Bug 1191976 - Intentionally crash if we hit an IPC FatalError in the parent process. r=billm

When the parent process has trouble deserializing an IPC message from the content
process, it originally killed that content process. This doesn't result in us
creating a crash report (and doing so is difficult if the FatalError is hit
off main thread). We now crash the parent process if we hit such a FatalError
in the parent process. This will hopefully give us an idea of how frequent
these FatalErrors are, since up until now we've been getting no crash data
for them.
This commit is contained in:
Mike Conley 2015-08-18 15:28:01 -04:00
parent 9012b9f439
commit 894fb80991

View File

@ -315,20 +315,18 @@ FatalError(const char* aProtocolName, const char* aMsg,
formattedMessage.AppendLiteral("]: \"");
formattedMessage.AppendASCII(aMsg);
if (aIsParent) {
formattedMessage.AppendLiteral("\". Killing child side as a result.");
#ifdef MOZ_CRASHREPORTER
// We're going to crash the parent process because at this time
// there's no other really nice way of getting a minidump out of
// this process if we're off the main thread.
formattedMessage.AppendLiteral("\". Intentionally crashing.");
NS_ERROR(formattedMessage.get());
if (aOtherPid != kInvalidProcessId && aOtherPid != base::GetCurrentProcId()) {
ScopedProcessHandle otherProcessHandle;
if (base::OpenProcessHandle(aOtherPid, &otherProcessHandle.rwget())) {
if (!base::KillProcess(otherProcessHandle,
base::PROCESS_END_KILLED_BY_USER, false)) {
NS_ERROR("May have failed to kill child!");
}
} else {
NS_ERROR("Failed to open child process when attempting kill.");
}
}
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorProtocol"),
nsDependentCString(aProtocolName));
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
nsDependentCString(aMsg));
#endif
MOZ_CRASH("IPC FatalError in the parent process!");
} else {
formattedMessage.AppendLiteral("\". abort()ing as a result.");
NS_RUNTIMEABORT(formattedMessage.get());