Bug 1160142 - For e10s plugin hangs take the minidump of the browser process before we message the chrome UI about the hang. r=billm

This commit is contained in:
Jim Mathies
2015-06-11 12:25:45 -05:00
parent c833e91268
commit 536efcfe2d
7 changed files with 153 additions and 17 deletions

View File

@@ -344,7 +344,7 @@ bool PluginModuleMapping::sIsLoadModuleOnStack = false;
} // anonymous namespace
void
mozilla::plugins::TerminatePlugin(uint32_t aPluginId)
mozilla::plugins::TerminatePlugin(uint32_t aPluginId, const nsString& aBrowserDumpId)
{
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
@@ -353,10 +353,10 @@ mozilla::plugins::TerminatePlugin(uint32_t aPluginId)
if (!pluginTag || !pluginTag->mPlugin) {
return;
}
nsAutoString dumpId(aBrowserDumpId);
nsRefPtr<nsNPAPIPlugin> plugin = pluginTag->mPlugin;
PluginModuleChromeParent* chromeParent = static_cast<PluginModuleChromeParent*>(plugin->GetLibrary());
chromeParent->TerminateChildProcess(MessageLoop::current());
chromeParent->TerminateChildProcess(MessageLoop::current(), &dumpId);
}
/* static */ PluginLibrary*
@@ -1148,7 +1148,8 @@ PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
// original plugin hang behaviour and kill the plugin container.
FinishHangUI();
#endif // XP_WIN
TerminateChildProcess(MessageLoop::current());
nsString dummy;
TerminateChildProcess(MessageLoop::current(), &dummy);
GetIPCChannel()->CloseWithTimeout();
return false;
}
@@ -1171,7 +1172,8 @@ PluginModuleContentParent::OnExitedSyncSend()
}
void
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop)
PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
nsAString* aBrowserDumpId)
{
#ifdef MOZ_CRASHREPORTER
#ifdef XP_WIN
@@ -1198,8 +1200,39 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop)
}
}
#endif // XP_WIN
// Generate base report, includes plugin and browser process minidumps.
if (crashReporter->GeneratePairedMinidump(this)) {
bool reportsReady = false;
// Check to see if we already have a browser dump id - with e10s plugin
// hangs we take this earlier (see ProcessHangMonitor) from a background
// thread. We do this before we message the main thread about the hang
// since the posted message will trash our browser stack state.
bool exists;
nsCOMPtr<nsIFile> browserDumpFile;
if (aBrowserDumpId && !aBrowserDumpId->IsEmpty() &&
CrashReporter::GetMinidumpForID(*aBrowserDumpId, getter_AddRefs(browserDumpFile)) &&
browserDumpFile &&
NS_SUCCEEDED(browserDumpFile->Exists(&exists)) && exists)
{
// We have a single browser report, generate a new plugin process parent
// report and pair it up with the browser report handed in.
reportsReady = crashReporter->GenerateMinidumpAndPair(this, browserDumpFile,
NS_LITERAL_CSTRING("browser"));
if (!reportsReady) {
browserDumpFile = nullptr;
CrashReporter::DeleteMinidumpFilesForID(*aBrowserDumpId);
}
}
// Generate crash report including plugin and browser process minidumps.
// The plugin process is the parent report with additional dumps including
// the browser process, content process when running under e10s, and
// various flash subprocesses if we're the flash module.
if (!reportsReady) {
reportsReady = crashReporter->GeneratePairedMinidump(this);
}
if (reportsReady) {
mPluginDumpID = crashReporter->ChildDumpID();
PLUGIN_LOG_DEBUG(
("generated paired browser/plugin minidumps: %s)",