Diff
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/CMakeLists.txt (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/CMakeLists.txt 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/CMakeLists.txt 2015-05-21 19:52:44 UTC (rev 184730)
@@ -641,6 +641,7 @@
PluginProcess/PluginProcess.messages.in
PluginProcess/WebProcessConnection.messages.in
+ Shared/ChildProcess.messages.in
Shared/WebConnection.messages.in
Shared/Authentication/AuthenticationManager.messages.in
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/ChangeLog 2015-05-21 19:52:44 UTC (rev 184730)
@@ -1,5 +1,58 @@
2015-05-21 Babak Shafiei <bshaf...@apple.com>
+ Merge r184503.
+
+ 2015-05-18 Brady Eidson <beid...@apple.com>
+
+ Networking process on iOS can be suspended and never exit.
+ <rdar://problem/20368630> and https://bugs.webkit.org/show_bug.cgi?id=144971
+
+ Reviewed by Darin Adler.
+
+ There's a few issues here.
+
+ 1 - When the NetworkProcessProxy goes away, it takes its process assertion with it. This causes
+ the Network process to suspend indefinitely, unable to ever respond to IPC::Connection callbacks.
+ We already solved this with WebProcess with a watchdog timer keeping both the process assertion
+ and xpc_connection alive while the process shuts down. This patch expands that to the network
+ process, and it will be easy to expand that to database and plugin processes doing forward.
+
+ 2 - All of our child processes either decide to self-terminate or listen for their connection to
+ close at which point they terminate. This leads to various races. We should
+ move to a model where the UI process explicitly tells them to shutdown, and this patch starts us
+ down that path.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * WebKit2.xcodeproj/project.pbxproj:
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::didReceiveMessage): Send ChildProcess messages to ChildProcess.
+
+ * Shared/ChildProcess.cpp:
+ (WebKit::ChildProcess::shutDown): For now, just terminate the process. In the future have the
+ process do cleanup work before it is terminated.
+ * Shared/ChildProcess.h:
+ * Shared/ChildProcess.messages.in: Added.
+
+ * Shared/ChildProcessProxy.cpp:
+ (WebKit::ChildProcessProxy::shutDownProcess): Set a watchdog and - if possible - explicitly message
+ the process to ShutDown.
+ (WebKit::ChildProcessProxy::abortProcessLaunchIfNeeded): Deleted.
+ * Shared/ChildProcessProxy.h:
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::~WebProcessPool): Explicitly tell the network process to shut down.
+
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::removeWebPage): Move abortProcessLaunchIfNeeded() and the watchdog timer
+ code to ChildProcessProxy::shutDownProcess.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::didReceiveMessage): Send ChildProcess messages to ChildProcess::didReceiveMessage.
+
+2015-05-21 Babak Shafiei <bshaf...@apple.com>
+
Merge r184370.
2015-05-14 Brady Eidson <beid...@apple.com>
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/DerivedSources.make (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/DerivedSources.make 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/DerivedSources.make 2015-05-21 19:52:44 UTC (rev 184730)
@@ -69,6 +69,7 @@
MESSAGE_RECEIVERS = \
AuthenticationManager \
+ ChildProcess \
CustomProtocolManager \
CustomProtocolManagerProxy \
DatabaseProcess \
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/NetworkProcess/NetworkProcess.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -31,6 +31,7 @@
#include "ArgumentCoders.h"
#include "Attachment.h"
#include "AuthenticationManager.h"
+#include "ChildProcessMessages.h"
#include "CustomProtocolManager.h"
#include "Logging.h"
#include "NetworkConnectionToWebProcess.h"
@@ -127,6 +128,11 @@
if (messageReceiverMap().dispatchMessage(connection, decoder))
return;
+ if (decoder.messageReceiverName() == Messages::ChildProcess::messageReceiverName()) {
+ ChildProcess::didReceiveMessage(connection, decoder);
+ return;
+ }
+
didReceiveNetworkProcessMessage(connection, decoder);
}
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -160,6 +160,11 @@
stopRunLoop();
}
+void ChildProcess::shutDown()
+{
+ terminate();
+}
+
#if !PLATFORM(COCOA)
void ChildProcess::platformInitialize()
{
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.h (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.h 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.h 2015-05-21 19:52:44 UTC (rev 184730)
@@ -93,11 +93,15 @@
static void stopNSAppRunLoop();
#endif
+ virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+
private:
// IPC::MessageSender
virtual IPC::Connection* messageSenderConnection() override;
virtual uint64_t messageSenderDestinationID() override;
+ void shutDown();
+
void terminationTimerFired();
void platformInitialize();
Copied: branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.messages.in (from rev 184503, trunk/Source/WebKit2/Shared/ChildProcess.messages.in) (0 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.messages.in (rev 0)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcess.messages.in 2015-05-21 19:52:44 UTC (rev 184730)
@@ -0,0 +1,25 @@
+# Copyright (C) 2015 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+messages -> ChildProcess {
+ ShutDown()
+}
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -26,6 +26,7 @@
#include "config.h"
#include "ChildProcessProxy.h"
+#include "ChildProcessMessages.h"
#include <wtf/RunLoop.h>
namespace WebKit {
@@ -150,22 +151,30 @@
m_pendingMessages.clear();
}
-void ChildProcessProxy::abortProcessLaunchIfNeeded()
-{
- if (state() != State::Launching)
- return;
-
- m_processLauncher->invalidate();
- m_processLauncher = nullptr;
-}
-
void ChildProcessProxy::shutDownProcess()
{
- if (!m_connection)
+ switch (state()) {
+ case State::Launching:
+ m_processLauncher->invalidate();
+ m_processLauncher = nullptr;
+ break;
+ case State::Running:
+#if PLATFORM(IOS)
+ // On iOS deploy a watchdog in the UI process, since the child process may be suspended.
+ // If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
+ ASSERT(m_connection);
+ m_connection->terminateSoon(30);
+#endif
+ break;
+ case State::Terminated:
return;
+ }
processWillShutDown(*m_connection);
+ if (canSendMessage())
+ send(Messages::ChildProcess::ShutDown(), 0);
+
m_connection->invalidate();
m_connection = nullptr;
}
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.h (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.h 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/Shared/ChildProcessProxy.h 2015-05-21 19:52:44 UTC (rev 184730)
@@ -72,10 +72,9 @@
bool canSendMessage() const { return state() != State::Terminated;}
bool sendMessage(std::unique_ptr<IPC::MessageEncoder>, unsigned messageSendFlags);
-protected:
void shutDownProcess();
- void abortProcessLaunchIfNeeded();
+protected:
// ProcessLauncher::Client
virtual void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override;
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -272,6 +272,11 @@
#ifndef NDEBUG
processPoolCounter.decrement();
#endif
+
+#if ENABLE(NETWORK_PROCESS)
+ if (m_networkProcess)
+ m_networkProcess->shutDownProcess();
+#endif
}
void WebProcessPool::initializeClient(const WKContextClientBase* client)
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/UIProcess/WebProcessProxy.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -245,16 +245,6 @@
if (!m_processPool->usesNetworkProcess() || state() == State::Terminated || !canTerminateChildProcess())
return;
- abortProcessLaunchIfNeeded();
-
-#if PLATFORM(IOS)
- if (state() == State::Running) {
- // On iOS deploy a watchdog in the UI process, since the child process may be suspended.
- // If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
- connection()->terminateSoon(30);
- }
-#endif
-
shutDown();
}
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-05-21 19:52:44 UTC (rev 184730)
@@ -1055,6 +1055,8 @@
51FA1E23180CCADE00C44BE9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC3DE46815A91763008D26FC /* Foundation.framework */; };
51FA2D7415212DF100C1BA0B /* InjectedBundleDOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FA2D5C15211A5000C1BA0B /* InjectedBundleDOMWindowExtension.cpp */; };
51FA2D7715212E2600C1BA0B /* WKBundleDOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FA2D7515212E1E00C1BA0B /* WKBundleDOMWindowExtension.cpp */; };
+ 51FAEC3A1B0657630009C4E7 /* ChildProcessMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FAEC371B0657310009C4E7 /* ChildProcessMessages.h */; };
+ 51FAEC3B1B0657680009C4E7 /* ChildProcessMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FAEC361B0657310009C4E7 /* ChildProcessMessageReceiver.cpp */; };
51FB08FF1639DE1A00EC324A /* WebResourceLoadScheduler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51ABF65616392F1500132A7A /* WebResourceLoadScheduler.cpp */; };
51FD18B51651FBAD00DBE1CE /* NetworkResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FD18B31651FBAD00DBE1CE /* NetworkResourceLoader.cpp */; };
51FD18B61651FBAD00DBE1CE /* NetworkResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */; };
@@ -3144,6 +3146,7 @@
516319911628980A00E22F00 /* NetworkProcessProxyMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessProxyMac.mm; path = mac/NetworkProcessProxyMac.mm; sourceTree = "<group>"; };
5163EA3F1ACC74820012D1E4 /* NativeContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeContextMenuItem.h; sourceTree = "<group>"; };
5163EA431ACC74AE0012D1E4 /* NativeContextMenuItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NativeContextMenuItem.mm; sourceTree = "<group>"; };
+ 5164C0941B05B757004F102A /* ChildProcess.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ChildProcess.messages.in; sourceTree = "<group>"; };
51654EFB184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UniqueIDBDatabaseBackingStoreSQLite.cpp; sourceTree = "<group>"; };
51654EFC184EF33F007DC837 /* UniqueIDBDatabaseBackingStoreSQLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueIDBDatabaseBackingStoreSQLite.h; sourceTree = "<group>"; };
51654EFF184EF34A007DC837 /* UniqueIDBDatabaseBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UniqueIDBDatabaseBackingStore.h; sourceTree = "<group>"; };
@@ -3262,6 +3265,8 @@
51FA2D5A15211A1E00C1BA0B /* InjectedBundleDOMWindowExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleDOMWindowExtension.h; sourceTree = "<group>"; };
51FA2D5C15211A5000C1BA0B /* InjectedBundleDOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleDOMWindowExtension.cpp; sourceTree = "<group>"; };
51FA2D7515212E1E00C1BA0B /* WKBundleDOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleDOMWindowExtension.cpp; sourceTree = "<group>"; };
+ 51FAEC361B0657310009C4E7 /* ChildProcessMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChildProcessMessageReceiver.cpp; sourceTree = "<group>"; };
+ 51FAEC371B0657310009C4E7 /* ChildProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildProcessMessages.h; sourceTree = "<group>"; };
51FB0902163A3B1C00EC324A /* NetworkProcessConnection.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = NetworkProcessConnection.messages.in; path = Network/NetworkProcessConnection.messages.in; sourceTree = "<group>"; };
51FD18B31651FBAD00DBE1CE /* NetworkResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkResourceLoader.cpp; path = NetworkProcess/NetworkResourceLoader.cpp; sourceTree = "<group>"; };
51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoader.h; path = NetworkProcess/NetworkResourceLoader.h; sourceTree = "<group>"; };
@@ -4729,6 +4734,7 @@
BC3065F91259344E00E71278 /* CacheModel.h */,
1A2D956E12848564001EB962 /* ChildProcess.cpp */,
1A2D956D12848564001EB962 /* ChildProcess.h */,
+ 5164C0941B05B757004F102A /* ChildProcess.messages.in */,
E1513C64166EABB200149FCB /* ChildProcessProxy.cpp */,
E1513C65166EABB200149FCB /* ChildProcessProxy.h */,
290F4271172A0C7400939FF0 /* ChildProcessSupplement.h */,
@@ -7227,6 +7233,8 @@
children = (
512F58A012A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp */,
512F58A112A883AD00629530 /* AuthenticationManagerMessages.h */,
+ 51FAEC361B0657310009C4E7 /* ChildProcessMessageReceiver.cpp */,
+ 51FAEC371B0657310009C4E7 /* ChildProcessMessages.h */,
E115C715190F8A2500ECC516 /* com.apple.WebKit.Databases.sb */,
E17AE2C216B9C63A001C42F1 /* com.apple.WebKit.NetworkProcess.sb */,
E1967E37150AB5E200C73169 /* com.apple.WebProcess.sb */,
@@ -8229,6 +8237,7 @@
1AB474DE184D44590051B622 /* WKBundlePageUIClient.h in Headers */,
BCF049E711FE20F600F86A58 /* WKBundlePrivate.h in Headers */,
BC60C5791240A546008C5E29 /* WKBundleRangeHandle.h in Headers */,
+ 51FAEC3A1B0657630009C4E7 /* ChildProcessMessages.h in Headers */,
BC5D24C716CD73C5007D5461 /* WKBundleRangeHandlePrivate.h in Headers */,
BC14DF9F120B635F00826C0C /* WKBundleScriptWorld.h in Headers */,
BC4075F6124FF0270068F20A /* WKCertificateInfo.h in Headers */,
@@ -9575,6 +9584,7 @@
1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */,
1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
+ 51FAEC3B1B0657680009C4E7 /* ChildProcessMessageReceiver.cpp in Sources */,
1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
1AA5889311EE70400061B882 /* NetscapePluginStream.cpp in Sources */,
Modified: branches/safari-601.1.32.2-branch/Source/WebKit2/WebProcess/WebProcess.cpp (184729 => 184730)
--- branches/safari-601.1.32.2-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2015-05-21 19:51:39 UTC (rev 184729)
+++ branches/safari-601.1.32.2-branch/Source/WebKit2/WebProcess/WebProcess.cpp 2015-05-21 19:52:44 UTC (rev 184730)
@@ -30,6 +30,7 @@
#include "APIPageGroupHandle.h"
#include "APIPageHandle.h"
#include "AuthenticationManager.h"
+#include "ChildProcessMessages.h"
#include "CustomProtocolManager.h"
#include "DrawingArea.h"
#include "EventDispatcher.h"
@@ -634,6 +635,11 @@
return;
}
+ if (decoder.messageReceiverName() == Messages::ChildProcess::messageReceiverName()) {
+ ChildProcess::didReceiveMessage(connection, decoder);
+ return;
+ }
+
LOG_ERROR("Unhandled web process message '%s:%s'", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
}