Title: [262846] trunk/Source/WebKit
Revision
262846
Author
katherine_che...@apple.com
Date
2020-06-10 12:04:56 -0700 (Wed, 10 Jun 2020)

Log Message

ASSERTION FAILED: suspendedState == State::Running in WebKit::WebResourceLoadStatisticsStore::suspend
https://bugs.webkit.org/show_bug.cgi?id=213031
<rdar://problem/64131092>

Reviewed by Chris Dumez.

There is a race condition if two calls are made to
WebResourceLoadStatisticsStore::suspend() simultanously.
WebResourceLoadStatisticsStore::resume() notifies the background
thread to continue and releases a lock, then sometimes the second call
to suspend obtains the lock and updates the suspendedState variable
before the background thread resumes and checks the result. This patch allows the
suspendedState to be either State::Running or State::WillSuspend to
account for this.

No new tests, this should fix http/wpt/service-workers/service-worker-spinning-fetch.https.html.

* NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
(WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
(WebKit::WebResourceLoadStatisticsStore::suspend):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (262845 => 262846)


--- trunk/Source/WebKit/ChangeLog	2020-06-10 17:59:49 UTC (rev 262845)
+++ trunk/Source/WebKit/ChangeLog	2020-06-10 19:04:56 UTC (rev 262846)
@@ -1,3 +1,26 @@
+2020-06-10  Kate Cheney  <katherine_che...@apple.com>
+
+        ASSERTION FAILED: suspendedState == State::Running in WebKit::WebResourceLoadStatisticsStore::suspend
+        https://bugs.webkit.org/show_bug.cgi?id=213031
+        <rdar://problem/64131092>
+
+        Reviewed by Chris Dumez.
+
+        There is a race condition if two calls are made to
+        WebResourceLoadStatisticsStore::suspend() simultanously.
+        WebResourceLoadStatisticsStore::resume() notifies the background
+        thread to continue and releases a lock, then sometimes the second call
+        to suspend obtains the lock and updates the suspendedState variable
+        before the background thread resumes and checks the result. This patch allows the
+        suspendedState to be either State::Running or State::WillSuspend to
+        account for this.
+
+        No new tests, this should fix http/wpt/service-workers/service-worker-spinning-fetch.https.html.
+
+        * NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp:
+        (WebKit::WebResourceLoadStatisticsStore::resourceLoadStatisticsUpdated):
+        (WebKit::WebResourceLoadStatisticsStore::suspend):
+
 2020-06-10  Alex Christensen  <achristen...@webkit.org>
 
         Revert r259770

Modified: trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp (262845 => 262846)


--- trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-06-10 17:59:49 UTC (rev 262845)
+++ trunk/Source/WebKit/NetworkProcess/Classifier/WebResourceLoadStatisticsStore.cpp	2020-06-10 19:04:56 UTC (rev 262846)
@@ -353,7 +353,7 @@
         if (!m_statisticsStore)
             return;
 
-        ASSERT(suspendedState == State::Running);
+        ASSERT(suspendedState != State::Suspended);
         m_statisticsStore->mergeStatistics(WTFMove(statistics));
 
         // We can cancel any pending request to process statistics since we're doing it synchronously below.
@@ -1443,7 +1443,7 @@
 
         while (suspendedState == State::Suspended)
             suspendedStateChangeCondition.wait(suspendedStateLock);
-        ASSERT(suspendedState == State::Running);
+        ASSERT(suspendedState != State::Suspended);
     });
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to