Title: [264032] trunk/Source/WebKit
Revision
264032
Author
[email protected]
Date
2020-07-07 11:44:00 -0700 (Tue, 07 Jul 2020)

Log Message

WebContent process sometimes kills itself because it is receiving too much IPC from the UIProcess
https://bugs.webkit.org/show_bug.cgi?id=214048
<rdar://problem/64844770>

Reviewed by Darin Adler.

There was logic in IPC::Connection::enqueueIncomingMessage() that would kill the XPC connection
if too many IPC messages had been queued without the main thread processing them. The intention
was to protect the UIProcess again a badly behavior WebProcess sending too much IPC and it would
in effect terminate that WebProcess. However, the logic would actually apply too ALL IPC
connections. In <rdar://problem/64844770>, we see that the WebProcess is stuck on a sync IPC and
thus not processing other incoming IPCs. The UIProcess is sending it a lot of IPC so the
WebProcess decides to kill its IPC connection, thus terminating itself, which does not make much
sense. To address the issue, we now enable to killing on too much IPC behavior only if IPC message
throttling is enabled for the IPC connection, which means it only impacts the UIProcess connections
to its WebProcesses.

* Platform/IPC/Connection.cpp:
(IPC::Connection::enableIncomingMessagesThrottling):
(IPC::Connection::enqueueIncomingMessage):
* Platform/IPC/Connection.h:
(IPC::Connection::isIncomingMessagesThrottlingEnabled const):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (264031 => 264032)


--- trunk/Source/WebKit/ChangeLog	2020-07-07 18:16:27 UTC (rev 264031)
+++ trunk/Source/WebKit/ChangeLog	2020-07-07 18:44:00 UTC (rev 264032)
@@ -1,3 +1,28 @@
+2020-07-07  Chris Dumez  <[email protected]>
+
+        WebContent process sometimes kills itself because it is receiving too much IPC from the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=214048
+        <rdar://problem/64844770>
+
+        Reviewed by Darin Adler.
+
+        There was logic in IPC::Connection::enqueueIncomingMessage() that would kill the XPC connection
+        if too many IPC messages had been queued without the main thread processing them. The intention
+        was to protect the UIProcess again a badly behavior WebProcess sending too much IPC and it would
+        in effect terminate that WebProcess. However, the logic would actually apply too ALL IPC
+        connections. In <rdar://problem/64844770>, we see that the WebProcess is stuck on a sync IPC and
+        thus not processing other incoming IPCs. The UIProcess is sending it a lot of IPC so the
+        WebProcess decides to kill its IPC connection, thus terminating itself, which does not make much
+        sense. To address the issue, we now enable to killing on too much IPC behavior only if IPC message
+        throttling is enabled for the IPC connection, which means it only impacts the UIProcess connections
+        to its WebProcesses.
+
+        * Platform/IPC/Connection.cpp:
+        (IPC::Connection::enableIncomingMessagesThrottling):
+        (IPC::Connection::enqueueIncomingMessage):
+        * Platform/IPC/Connection.h:
+        (IPC::Connection::isIncomingMessagesThrottlingEnabled const):
+
 2020-07-07  Simon Fraser  <[email protected]>
 
         Unable to scroll elcomerico.pe page until the page finishes loading

Modified: trunk/Source/WebKit/Platform/IPC/Connection.cpp (264031 => 264032)


--- trunk/Source/WebKit/Platform/IPC/Connection.cpp	2020-07-07 18:16:27 UTC (rev 264031)
+++ trunk/Source/WebKit/Platform/IPC/Connection.cpp	2020-07-07 18:44:00 UTC (rev 264032)
@@ -811,7 +811,7 @@
 
 void Connection::enableIncomingMessagesThrottling()
 {
-    if (m_incomingMessagesThrottler)
+    if (isIncomingMessagesThrottlingEnabled())
         return;
 
     m_incomingMessagesThrottler = makeUnique<MessagesThrottler>(*this, &Connection::dispatchIncomingMessages);
@@ -956,9 +956,9 @@
         if (m_wasKilled)
             return;
 
-        if (m_incomingMessages.size() >= maxPendingIncomingMessagesKillingThreshold) {
+        if (isIncomingMessagesThrottlingEnabled() && m_incomingMessages.size() >= maxPendingIncomingMessagesKillingThreshold) {
             if (kill()) {
-                RELEASE_LOG_ERROR(IPC, "%p - Connection::enqueueIncomingMessage: Over %zu incoming messages have been queued without the main thread processing them, killing the connection as the remote process seems to be misbehaving", this, maxPendingIncomingMessagesKillingThreshold);
+                RELEASE_LOG_FAULT(IPC, "%p - Connection::enqueueIncomingMessage: Over %zu incoming messages have been queued without the main thread processing them, killing the connection as the remote process seems to be misbehaving", this, maxPendingIncomingMessagesKillingThreshold);
                 m_incomingMessages.clear();
             }
             return;
@@ -967,12 +967,12 @@
 
         m_incomingMessages.append(WTFMove(incomingMessage));
 
-        if (m_incomingMessagesThrottler && m_incomingMessages.size() != 1)
+        if (isIncomingMessagesThrottlingEnabled() && m_incomingMessages.size() != 1)
             return;
     }
 
     RunLoop::main().dispatch([protectedThis = makeRef(*this)]() mutable {
-        if (protectedThis->m_incomingMessagesThrottler)
+        if (protectedThis->isIncomingMessagesThrottlingEnabled())
             protectedThis->dispatchIncomingMessages();
         else
             protectedThis->dispatchOneIncomingMessage();

Modified: trunk/Source/WebKit/Platform/IPC/Connection.h (264031 => 264032)


--- trunk/Source/WebKit/Platform/IPC/Connection.h	2020-07-07 18:16:27 UTC (rev 264031)
+++ trunk/Source/WebKit/Platform/IPC/Connection.h	2020-07-07 18:44:00 UTC (rev 264032)
@@ -274,6 +274,8 @@
     Connection(Identifier, bool isServer, Client&);
     void platformInitialize(Identifier);
     void platformInvalidate();
+
+    bool isIncomingMessagesThrottlingEnabled() const { return !!m_incomingMessagesThrottler; }
     
     std::unique_ptr<Decoder> waitForMessage(MessageName, uint64_t destinationID, Seconds timeout, OptionSet<WaitForOption>);
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to