Bug 1066812 - Set AbortOnError in the ContentProcess on initialization. r=billm.
☠☠ backed out by d8c4ac35b349 ☠ ☠
authorMike Conley <mconley@mozilla.com>
Fri, 13 Feb 2015 14:10:56 -0500
changeset 231226 3e9cc0ba5dfb5fe1af0a264d784a9c6f35204c8f
parent 231225 3148c577bfd9cfd80ee20481163bfd40d8bc027b
child 231227 551548754f83facf6d42be22b0f7b0290c9ad5cd
push id28348
push userkwierso@gmail.com
push dateMon, 02 Mar 2015 20:13:43 +0000
treeherdermozilla-central@abb7f0d180da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1066812
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1066812 - Set AbortOnError in the ContentProcess on initialization. r=billm. This will cause the content process to take itself down in the event that it loses communication with the parent process. This case is particularly important for the case where the parent process crashes while the content process is blocked or busy on the main thread, as the content process will no longer continue to exist as a zombie process, but will shut down after a short delay.
dom/ipc/ContentChild.cpp
ipc/glue/MessageChannel.h
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -610,16 +610,20 @@ ContentChild::Init(MessageLoop* aIOLoop,
       return false;
     }
     sSingleton = this;
 
     // Make sure there's an nsAutoScriptBlocker on the stack when dispatching
     // urgent messages.
     GetIPCChannel()->BlockScripts();
 
+    // If communications with the parent have broken down, take the process
+    // down so it's not hanging around.
+    GetIPCChannel()->SetAbortOnError(true);
+
 #ifdef MOZ_X11
     // Send the parent our X socket to act as a proxy reference for our X
     // resources.
     int xSocketFd = ConnectionNumber(DefaultXDisplay());
     SendBackUpXResources(FileDescriptor(xSocketFd));
 #endif
 
 #ifdef MOZ_CRASHREPORTER
@@ -2566,16 +2570,18 @@ ContentChild::RecvAssociatePluginId(cons
 bool
 ContentChild::RecvShutdown()
 {
     nsCOMPtr<nsIObserverService> os = services::GetObserverService();
     if (os) {
         os->NotifyObservers(this, "content-child-shutdown", nullptr);
     }
 
+    GetIPCChannel()->SetAbortOnError(false);
+
     // Ignore errors here. If this fails, the parent will kill us after a
     // timeout.
     unused << SendFinishShutdown();
     return true;
 }
 
 PBrowserOrId
 ContentChild::GetBrowserOrId(TabChild* aTabChild)
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -83,17 +83,17 @@ class MessageChannel : HasResultCodes
     // Force the channel to behave as if a channel error occurred. Valid
     // for process links only, not thread links.
     void CloseWithError();
 
     void CloseWithTimeout();
 
     void SetAbortOnError(bool abort)
     {
-        mAbortOnError = true;
+        mAbortOnError = abort;
     }
 
     // Misc. behavioral traits consumers can request for this channel
     enum ChannelFlags {
       REQUIRE_DEFAULT                         = 0,
       // Windows: if this channel operates on the UI thread, indicates
       // WindowsMessageLoop code should enable deferred native message
       // handling to prevent deadlocks. Should only be used for protocols