Diff
Modified: trunk/Source/WebKit/ChangeLog (231347 => 231348)
--- trunk/Source/WebKit/ChangeLog 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/ChangeLog 2018-05-04 06:03:42 UTC (rev 231348)
@@ -1,3 +1,34 @@
+2018-05-03 Chris Dumez <[email protected]>
+
+ More aggressively terminate child processes when the connection to their parent process is severed
+ https://bugs.webkit.org/show_bug.cgi?id=177972
+ <rdar://problem/33317607>
+
+ Reviewed by Geoff Garen.
+
+ More aggressively terminate child processes when the connection to their parent process is severed.
+ Previously, we would dispatch to the main thread and then exit the process. This would sometimes
+ cause the process to say alive for 10 seconds until our watchdog would forcefully terminate the
+ process. This could happen in particular when the main thread is blocked on a synchronous IPC.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::didClose): Deleted.
+ * NetworkProcess/NetworkProcess.h:
+ * PluginProcess/PluginProcess.cpp:
+ (WebKit::PluginProcess::didClose): Deleted.
+ * PluginProcess/PluginProcess.h:
+ * Shared/ChildProcess.cpp:
+ (WebKit::ChildProcess::didClose):
+ (WebKit::didCloseOnConnectionWorkQueue):
+ (WebKit::ChildProcess::terminationTimerFired):
+ * Shared/ChildProcess.h:
+ * StorageProcess/StorageProcess.cpp:
+ (WebKit::StorageProcess::didClose): Deleted.
+ * StorageProcess/StorageProcess.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::didClose): Deleted.
+ * WebProcess/WebProcess.h:
+
2018-05-03 Yusuke Suzuki <[email protected]>
Use default std::optional if it is provided
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (231347 => 231348)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-05-04 06:03:42 UTC (rev 231348)
@@ -190,12 +190,6 @@
didReceiveSyncNetworkProcessMessage(connection, decoder, replyEncoder);
}
-void NetworkProcess::didClose(IPC::Connection&)
-{
- // The UIProcess just exited.
- stopRunLoop();
-}
-
void NetworkProcess::didCreateDownload()
{
disableTermination();
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (231347 => 231348)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-05-04 06:03:42 UTC (rev 231348)
@@ -188,7 +188,6 @@
// IPC::Connection::Client
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
- void didClose(IPC::Connection&) override;
// DownloadManager::Client
void didCreateDownload() override;
Modified: trunk/Source/WebKit/PluginProcess/PluginProcess.cpp (231347 => 231348)
--- trunk/Source/WebKit/PluginProcess/PluginProcess.cpp 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/PluginProcess/PluginProcess.cpp 2018-05-04 06:03:42 UTC (rev 231348)
@@ -119,13 +119,6 @@
didReceivePluginProcessMessage(connection, decoder);
}
-void PluginProcess::didClose(IPC::Connection&)
-{
- // The UI process has crashed, just quit.
- // FIXME: If the plug-in is spinning in the main loop, we'll never get this message.
- stopRunLoop();
-}
-
void PluginProcess::initializePluginProcess(PluginProcessCreationParameters&& parameters)
{
ASSERT(!m_pluginModule);
Modified: trunk/Source/WebKit/PluginProcess/PluginProcess.h (231347 => 231348)
--- trunk/Source/WebKit/PluginProcess/PluginProcess.h 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/PluginProcess/PluginProcess.h 2018-05-04 06:03:42 UTC (rev 231348)
@@ -87,7 +87,6 @@
// IPC::Connection::Client
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
- void didClose(IPC::Connection&) override;
// Message handlers.
void didReceivePluginProcessMessage(IPC::Connection&, IPC::Decoder&);
Modified: trunk/Source/WebKit/Shared/ChildProcess.cpp (231347 => 231348)
--- trunk/Source/WebKit/Shared/ChildProcess.cpp 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/Shared/ChildProcess.cpp 2018-05-04 06:03:42 UTC (rev 231348)
@@ -50,19 +50,15 @@
{
}
-static void didCloseOnConnectionWorkQueue(IPC::Connection*)
+void ChildProcess::didClose(IPC::Connection&)
{
- // If the connection has been closed and we haven't responded in the main thread for 10 seconds
- // the process will exit forcibly.
- auto watchdogDelay = 10_s;
+ // We call _exit() in didCloseOnConnectionWorkQueue.
+ ASSERT_NOT_REACHED();
+}
- WorkQueue::create("com.apple.WebKit.ChildProcess.WatchDogQueue")->dispatchAfter(watchdogDelay, [] {
- // We use _exit here since the watchdog callback is called from another thread and we don't want
- // global destructors or atexit handlers to be called from this thread while the main thread is busy
- // doing its thing.
- RELEASE_LOG_ERROR(IPC, "Exiting process early due to unacknowledged closed-connection");
- _exit(EXIT_FAILURE);
- });
+NO_RETURN static void didCloseOnConnectionWorkQueue(IPC::Connection*)
+{
+ _exit(EXIT_SUCCESS);
}
void ChildProcess::initialize(const ChildProcessInitializationParameters& parameters)
Modified: trunk/Source/WebKit/Shared/ChildProcess.h (231347 => 231348)
--- trunk/Source/WebKit/Shared/ChildProcess.h 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/Shared/ChildProcess.h 2018-05-04 06:03:42 UTC (rev 231348)
@@ -115,6 +115,7 @@
// IPC::Connection::Client.
void didReceiveInvalidMessage(IPC::Connection&, IPC::StringReference messageReceiverName, IPC::StringReference messageName) final;
+ void didClose(IPC::Connection&) final;
void shutDown();
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.cpp (231347 => 231348)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.cpp 2018-05-04 06:03:42 UTC (rev 231348)
@@ -97,20 +97,7 @@
}
#endif
-void StorageProcess::didClose(IPC::Connection& connection)
-{
#if ENABLE(SERVICE_WORKER)
- if (RefPtr<WebSWServerToContextConnection> serverToContextConnection = connectionToContextProcessFromIPCConnection(connection)) {
- connectionToContextProcessWasClosed(serverToContextConnection.releaseNonNull());
- return;
- }
-#else
- UNUSED_PARAM(connection);
-#endif
- stopRunLoop();
-}
-
-#if ENABLE(SERVICE_WORKER)
void StorageProcess::connectionToContextProcessWasClosed(Ref<WebSWServerToContextConnection>&& serverToContextConnection)
{
auto& securityOrigin = serverToContextConnection->securityOrigin();
Modified: trunk/Source/WebKit/StorageProcess/StorageProcess.h (231347 => 231348)
--- trunk/Source/WebKit/StorageProcess/StorageProcess.h 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/StorageProcess/StorageProcess.h 2018-05-04 06:03:42 UTC (rev 231348)
@@ -122,7 +122,6 @@
// IPC::Connection::Client
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
- void didClose(IPC::Connection&) override;
// Message Handlers
void initializeWebsiteDataStore(const StorageProcessCreationParameters&);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (231347 => 231348)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2018-05-04 06:03:42 UTC (rev 231348)
@@ -670,29 +670,6 @@
LOG_ERROR("Unhandled web process message '%s:%s'", decoder.messageReceiverName().toString().data(), decoder.messageName().toString().data());
}
-void WebProcess::didClose(IPC::Connection&)
-{
-#if !defined(NDEBUG) || PLATFORM(GTK) || PLATFORM(WPE)
- for (auto& page : copyToVector(m_pageMap.values()))
- page->close();
-#endif
-
-#ifndef NDEBUG
- GCController::singleton().garbageCollectSoon();
- FontCache::singleton().invalidate();
- MemoryCache::singleton().setDisabled(true);
-#endif
-
-#if ENABLE(VIDEO)
- // FIXME(146657): This explicit media stop command should not be necessary
- if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedManagerIfExists())
- platformMediaSessionManager->stopAllMediaPlaybackForProcess();
-#endif
-
- // The UI process closed this connection, shut down.
- stopRunLoop();
-}
-
WebFrame* WebProcess::webFrame(uint64_t frameID) const
{
return m_frameMap.get(frameID);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (231347 => 231348)
--- trunk/Source/WebKit/WebProcess/WebProcess.h 2018-05-04 05:32:41 UTC (rev 231347)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h 2018-05-04 06:03:42 UTC (rev 231348)
@@ -365,7 +365,6 @@
friend class WebConnectionToUIProcess;
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override;
- void didClose(IPC::Connection&) override;
// Implemented in generated WebProcessMessageReceiver.cpp
void didReceiveWebProcessMessage(IPC::Connection&, IPC::Decoder&);