Title: [286299] trunk
Revision
286299
Author
[email protected]
Date
2021-11-30 08:27:07 -0800 (Tue, 30 Nov 2021)

Log Message

ServiceWorkerContainer does not respond well to network process crash
https://bugs.webkit.org/show_bug.cgi?id=233626

Reviewed by Chris Dumez.

Source/WebCore:

Add a boolean to SWClientConnection to identify whether connection is closed.
ServiceWorkerContainer will retrieve a new connection if its existing connection is closed.
Covered by updated test.

* workers/service/SWClientConnection.h:
(WebCore::SWClientConnection::isClosed const):
(WebCore::SWClientConnection::setIsClosed):
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::ensureSWClientConnection):

Source/WebKit:

Set SW client connection as closed when IPC connection gets closed.

* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::connectionToServerLost):

LayoutTests:

* http/wpt/service-workers/service-worker-networkprocess-crash.html:
* platform/mac-wk2/TestExpectations:
Remove flaky expectation as test is no longer flaky according results.webkit.org.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (286298 => 286299)


--- trunk/LayoutTests/ChangeLog	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/LayoutTests/ChangeLog	2021-11-30 16:27:07 UTC (rev 286299)
@@ -1,3 +1,14 @@
+2021-11-30  Youenn Fablet  <[email protected]>
+
+        ServiceWorkerContainer does not respond well to network process crash
+        https://bugs.webkit.org/show_bug.cgi?id=233626
+
+        Reviewed by Chris Dumez.
+
+        * http/wpt/service-workers/service-worker-networkprocess-crash.html:
+        * platform/mac-wk2/TestExpectations:
+        Remove flaky expectation as test is no longer flaky according results.webkit.org.
+
 2021-11-30  Chris Dumez  <[email protected]>
 
         [GLIB] REGRESSION(r268539): imported/w3c/web-platform-tests/webaudio/the-audio-api/the-stereopanner-interface/no-dezippering.html is failing

Modified: trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html (286298 => 286299)


--- trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/LayoutTests/http/wpt/service-workers/service-worker-networkprocess-crash.html	2021-11-30 16:27:07 UTC (rev 286299)
@@ -52,7 +52,7 @@
         testRunner.terminateNetworkProcess();
 
     let count = 0;
-    while (count++ < 20) {
+    while (count++ < 100) {
         const frame = await withFrame(scope + "/empty.html");
         if (frame.contentWindow.navigator.serviceWorker.controller)
             break;
@@ -59,7 +59,9 @@
         frame.remove();
         await new Promise(resolve => setTimeout(resolve, 50));
     }
-    assert_true(count < 20);
+    assert_true(count < 100);
+
+    await navigator.serviceWorker.getRegistration(scope);
 }, "Frame being controlled after network process crash");
 </script>
 </body>

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (286298 => 286299)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2021-11-30 16:27:07 UTC (rev 286299)
@@ -1032,8 +1032,6 @@
 
 webkit.org/b/207465 [ Debug ] storage/indexeddb/intversion-long-queue.html [ Pass Failure ]
 
-webkit.org/b/207466 http/wpt/service-workers/service-worker-networkprocess-crash.html [ Pass Failure ]
-
 webkit.org/b/207632 tiled-drawing/scrolling/sticky/sticky-during-rubberband.html [ Pass ImageOnlyFailure ]
 
 webkit.org/b/207631 tiled-drawing/scrolling/fixed/fixed-during-rubberband.html [ Pass ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (286298 => 286299)


--- trunk/Source/WebCore/ChangeLog	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/Source/WebCore/ChangeLog	2021-11-30 16:27:07 UTC (rev 286299)
@@ -1,3 +1,20 @@
+2021-11-30  Youenn Fablet  <[email protected]>
+
+        ServiceWorkerContainer does not respond well to network process crash
+        https://bugs.webkit.org/show_bug.cgi?id=233626
+
+        Reviewed by Chris Dumez.
+
+        Add a boolean to SWClientConnection to identify whether connection is closed.
+        ServiceWorkerContainer will retrieve a new connection if its existing connection is closed.
+        Covered by updated test.
+
+        * workers/service/SWClientConnection.h:
+        (WebCore::SWClientConnection::isClosed const):
+        (WebCore::SWClientConnection::setIsClosed):
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::ensureSWClientConnection):
+
 2021-11-30  Rob Buis  <[email protected]>
 
         Null check in previousLinePosition

Modified: trunk/Source/WebCore/workers/service/SWClientConnection.h (286298 => 286299)


--- trunk/Source/WebCore/workers/service/SWClientConnection.h	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/Source/WebCore/workers/service/SWClientConnection.h	2021-11-30 16:27:07 UTC (rev 286299)
@@ -101,6 +101,7 @@
     virtual void getPushPermissionState(ServiceWorkerRegistrationIdentifier, GetPushPermissionStateCallback&&) = 0;
 
     WEBCORE_EXPORT void registerServiceWorkerClients();
+    bool isClosed() const { return m_isClosed; }
 
 protected:
     WEBCORE_EXPORT SWClientConnection();
@@ -117,6 +118,7 @@
     WEBCORE_EXPORT void notifyClientsOfControllerChange(const HashSet<ScriptExecutionContextIdentifier>& contextIdentifiers, ServiceWorkerData&& newController);
 
     WEBCORE_EXPORT void clearPendingJobs();
+    void setIsClosed() { m_isClosed = true; }
 
 private:
     virtual void scheduleJobInServer(const ServiceWorkerJobData&) = 0;
@@ -124,6 +126,7 @@
     enum class IsJobComplete { No, Yes };
     bool postTaskForJob(ServiceWorkerJobIdentifier, IsJobComplete, Function<void(ServiceWorkerJob&)>&&);
 
+    bool m_isClosed { false };
     HashMap<ServiceWorkerJobIdentifier, ServiceWorkerOrClientIdentifier> m_scheduledJobSources;
 };
 

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (286298 => 286299)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2021-11-30 16:27:07 UTC (rev 286299)
@@ -526,7 +526,7 @@
 SWClientConnection& ServiceWorkerContainer::ensureSWClientConnection()
 {
     ASSERT(scriptExecutionContext());
-    if (!m_swConnection) {
+    if (!m_swConnection || m_swConnection->isClosed()) {
         auto& context = *scriptExecutionContext();
         if (is<WorkerGlobalScope>(context))
             m_swConnection = &downcast<WorkerGlobalScope>(context).swClientConnection();

Modified: trunk/Source/WebKit/ChangeLog (286298 => 286299)


--- trunk/Source/WebKit/ChangeLog	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/Source/WebKit/ChangeLog	2021-11-30 16:27:07 UTC (rev 286299)
@@ -1,3 +1,15 @@
+2021-11-30  Youenn Fablet  <[email protected]>
+
+        ServiceWorkerContainer does not respond well to network process crash
+        https://bugs.webkit.org/show_bug.cgi?id=233626
+
+        Reviewed by Chris Dumez.
+
+        Set SW client connection as closed when IPC connection gets closed.
+
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        (WebKit::WebSWClientConnection::connectionToServerLost):
+
 2021-11-30  Kimmo Kinnunen  <[email protected]>
 
         GraphicsContextGL should have ANGLE-specific subclass

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (286298 => 286299)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2021-11-30 16:20:02 UTC (rev 286298)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2021-11-30 16:27:07 UTC (rev 286299)
@@ -225,6 +225,7 @@
 
 void WebSWClientConnection::connectionToServerLost()
 {
+    setIsClosed();
     clear();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to