Title: [293156] releases/WebKitGTK/webkit-2.36/Source/WebKit
Revision
293156
Author
carlo...@webkit.org
Date
2022-04-21 02:51:24 -0700 (Thu, 21 Apr 2022)

Log Message

Merge r292099 - [GTK][WPE] Exit cleanly if Connection to UIProcess severed. Regression (r214307)
https://bugs.webkit.org/show_bug.cgi?id=235224

This patch reverts the WPE and GTK specific code removed in '[WK2] Make
establishing a connection between the WebProcess and the Network process more
robust' (r12345):

GTK+ and WPE ports don't exit on send sync message failure. In those particular
cases, the network process can be terminated by the UI process while the
Web process is still initializing, so we always want to exit instead of crashing. This can
happen when the WebView is created and then destroyed quickly.
See https://bugs.webkit.org/show_bug.cgi?id=183348.

Reviewed by Carlos Garcia Campos.

* WebProcess/WebProcess.cpp:
(WebKit::getNetworkProcessConnection):
(WebKit::WebProcess::getGPUProcessConnection):
(WebKit::getWebAuthnProcessConnection):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog (293155 => 293156)


--- releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog	2022-04-21 09:51:21 UTC (rev 293155)
+++ releases/WebKitGTK/webkit-2.36/Source/WebKit/ChangeLog	2022-04-21 09:51:24 UTC (rev 293156)
@@ -1,3 +1,25 @@
+2022-03-30  Pablo Saavedra  <psaave...@igalia.com>
+
+        [GTK][WPE] Exit cleanly if Connection to UIProcess severed. Regression (r214307)
+        https://bugs.webkit.org/show_bug.cgi?id=235224
+
+        This patch reverts the WPE and GTK specific code removed in '[WK2] Make
+        establishing a connection between the WebProcess and the Network process more
+        robust' (r12345):
+
+        GTK+ and WPE ports don't exit on send sync message failure. In those particular
+        cases, the network process can be terminated by the UI process while the
+        Web process is still initializing, so we always want to exit instead of crashing. This can
+        happen when the WebView is created and then destroyed quickly.
+        See https://bugs.webkit.org/show_bug.cgi?id=183348.
+
+        Reviewed by Carlos Garcia Campos.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::getNetworkProcessConnection):
+        (WebKit::WebProcess::getGPUProcessConnection):
+        (WebKit::getWebAuthnProcessConnection):
+
 2022-03-22  Miguel Gomez  <mago...@igalia.com>
 
         Ensure that proxies are invalidated before destroying them.

Modified: releases/WebKitGTK/webkit-2.36/Source/WebKit/WebProcess/WebProcess.cpp (293155 => 293156)


--- releases/WebKitGTK/webkit-2.36/Source/WebKit/WebProcess/WebProcess.cpp	2022-04-21 09:51:21 UTC (rev 293155)
+++ releases/WebKitGTK/webkit-2.36/Source/WebKit/WebProcess/WebProcess.cpp	2022-04-21 09:51:24 UTC (rev 293156)
@@ -1113,6 +1113,20 @@
     injectedBundle->setBundleParameters(value);
 }
 
+NO_RETURN inline void failedToSendSyncMessage()
+{
+#if PLATFORM(GTK) || PLATFORM(WPE)
+    // GTK and WPE ports don't exit on send sync message failure.
+    // In this particular case, the network process can be terminated by the UI process while the
+    // Web process is still initializing, so we always want to exit instead of crashing. This can
+    // happen when the WebView is created and then destroyed quickly.
+    // See https://bugs.webkit.org/show_bug.cgi?id=183348.
+    exit(0);
+#else
+    CRASH();
+#endif
+}
+
 static NetworkProcessConnectionInfo getNetworkProcessConnection(IPC::Connection& connection)
 {
     NetworkProcessConnectionInfo connectionInfo;
@@ -1132,7 +1146,7 @@
     unsigned failedAttempts = 0;
     while (!requestConnection()) {
         if (++failedAttempts >= maxFailedAttempts)
-            CRASH();
+            failedToSendSyncMessage();
 
         RELEASE_LOG_ERROR(Process, "getNetworkProcessConnection: Failed to get connection to network process, will retry...");
 
@@ -1285,7 +1299,7 @@
         // If we failed the first time, retry once. The attachment may have become invalid
         // before it was received by the web process if the network process crashed.
         if (!connection.sendSync(Messages::WebProcessProxy::GetGPUProcessConnection(parameters), Messages::WebProcessProxy::GetGPUProcessConnection::Reply(connectionInfo), 0))
-            CRASH();
+            failedToSendSyncMessage();
     }
 
     return connectionInfo;
@@ -1370,7 +1384,7 @@
         // before it was received by the web process if the network process crashed.
         if (!connection.sendSync(Messages::WebProcessProxy::GetWebAuthnProcessConnection(), Messages::WebProcessProxy::GetWebAuthnProcessConnection::Reply(connectionInfo), 0)) {
             RELEASE_LOG_ERROR(WebAuthn, "getWebAuthnProcessConnection: Unable to connect to WebAuthn process (Terminating)");
-            CRASH();
+            failedToSendSyncMessage();
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to