зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1790611 - Add a high priority NotifyShutdownSuccess that avoids blaming the content process with a dump. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D157292
This commit is contained in:
Родитель
d65f8a305c
Коммит
4ffcc4b964
|
@ -3055,9 +3055,9 @@ void ContentChild::ShutdownInternal() {
|
|||
SendShutdownPerfStats(PerfStats::CollectLocalPerfStatsJSON());
|
||||
}
|
||||
|
||||
// Start a timer that will insure we quickly exit after a reasonable
|
||||
// period of time. Prevents shutdown hangs after our connection to the
|
||||
// parent closes.
|
||||
// Start a timer that will ensure we quickly exit after a reasonable period
|
||||
// of time. Prevents shutdown hangs after our connection to the parent
|
||||
// closes or when the parent is too busy to ever kill us.
|
||||
CrashReporter::AppendToCrashReportAnnotation(
|
||||
CrashReporter::Annotation::IPCShutdownState, "StartForceKillTimer"_ns);
|
||||
StartForceKillTimer();
|
||||
|
@ -3065,7 +3065,16 @@ void ContentChild::ShutdownInternal() {
|
|||
CrashReporter::AppendToCrashReportAnnotation(
|
||||
CrashReporter::Annotation::IPCShutdownState,
|
||||
"SendFinishShutdown (sending)"_ns);
|
||||
|
||||
// Notify the parent that we are done with shutdown. This is sent with high
|
||||
// priority and will just flag we are done.
|
||||
Unused << SendNotifyShutdownSuccess();
|
||||
|
||||
// Now tell the parent to actually destroy our channel which will make end
|
||||
// our process. This is expected to be the last event the parent will
|
||||
// ever process for this ContentChild.
|
||||
bool sent = SendFinishShutdown();
|
||||
|
||||
CrashReporter::AppendToCrashReportAnnotation(
|
||||
CrashReporter::Annotation::IPCShutdownState,
|
||||
sent ? "SendFinishShutdown (sent)"_ns : "SendFinishShutdown (failed)"_ns);
|
||||
|
|
|
@ -1855,11 +1855,24 @@ void ContentParent::ShutDownProcess(ShutDownMethod aMethod) {
|
|||
ShutDownMessageManager();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvNotifyShutdownSuccess() {
|
||||
if (!mShutdownPending) {
|
||||
return IPC_FAIL(this, "RecvNotifyShutdownSuccess without mShutdownPending");
|
||||
}
|
||||
|
||||
mIsNotifiedShutdownSuccess = true;
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvFinishShutdown() {
|
||||
if (!mShutdownPending) {
|
||||
return IPC_FAIL(this, "RecvFinishShutdown without mShutdownPending");
|
||||
}
|
||||
|
||||
// At this point, we already called ShutDownProcess once with
|
||||
// SEND_SHUTDOWN_MESSAGE. To actually close the channel, we call
|
||||
// ShutDownProcess again with CLOSE_CHANNEL.
|
||||
MOZ_ASSERT(mShutdownPending);
|
||||
if (mCalledClose) {
|
||||
MaybeLogBlockShutdownDiagnostics(
|
||||
this, "RecvFinishShutdown: Channel already closed.", __FILE__,
|
||||
|
@ -4318,10 +4331,16 @@ void ContentParent::KillHard(const char* aReason) {
|
|||
mForceKillTimer = nullptr;
|
||||
|
||||
RemoveShutdownBlockers();
|
||||
nsCString reason = nsDependentCString(aReason);
|
||||
|
||||
GeneratePairedMinidump(aReason);
|
||||
|
||||
nsDependentCString reason(aReason);
|
||||
// If we find mIsNotifiedShutdownSuccess there is no reason to blame this
|
||||
// content process, most probably our parent process is just slow in
|
||||
// processing its own main thread queue.
|
||||
if (!mIsNotifiedShutdownSuccess) {
|
||||
GeneratePairedMinidump(aReason);
|
||||
} else {
|
||||
reason = nsDependentCString("KillHard after IsNotifiedShutdownSuccess.");
|
||||
}
|
||||
Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1);
|
||||
|
||||
ProcessHandle otherProcessHandle;
|
||||
|
|
|
@ -469,6 +469,8 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
mozilla::ipc::IPCResult RecvFinishShutdown();
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyShutdownSuccess();
|
||||
|
||||
void MaybeInvokeDragSession(BrowserParent* aParent);
|
||||
|
||||
PContentPermissionRequestParent* AllocPContentPermissionRequestParent(
|
||||
|
@ -1645,6 +1647,8 @@ class ContentParent final : public PContentParent,
|
|||
|
||||
static uint32_t sMaxContentProcesses;
|
||||
static Maybe<TimeStamp> sLastContentProcessLaunch;
|
||||
|
||||
bool mIsNotifiedShutdownSuccess = false;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(ContentParent, NS_CONTENTPARENT_IID)
|
||||
|
|
|
@ -1285,6 +1285,11 @@ parent:
|
|||
|
||||
async RequestAnonymousTemporaryFile(uint64_t aID);
|
||||
|
||||
/**
|
||||
* Notifies the parent that the child needs no more ForceKill dump.
|
||||
*/
|
||||
[Priority=control] async NotifyShutdownSuccess();
|
||||
|
||||
/**
|
||||
* Notifies the parent to continue shutting down after the child performs
|
||||
* its shutdown tasks.
|
||||
|
|
Загрузка…
Ссылка в новой задаче