Title: [245931] branches/safari-607-branch/Source/WebKit

Diff

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (245930 => 245931)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-05-31 00:30:28 UTC (rev 245930)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-05-31 00:30:30 UTC (rev 245931)
@@ -1,5 +1,33 @@
 2019-05-30  Kocsen Chung  <[email protected]>
 
+        Apply patch. rdar://problem/51264847
+
+    2019-05-30  Chris Dumez  <[email protected]>
+
+            <rdar://problem/50435250> v2: CrashTracer: Crash in WebProcessCache::removeProcess
+
+            Reviewed by Geoff Garen.
+
+            * UIProcess/WebProcessCache.cpp:
+            (WebKit::WebProcessCache::removeProcess):
+            This code change is to avoid crashing if my speculative fix below does not work. If
+            WebProcessCache::removeProcess() gets called with a process whole registrable domain
+            is empty (or null), remove it the slow way from the HashMap instead of trying to look
+            up the bad registrable domain in the HashMap. This ensures we do no crash but still
+            remove the process we're supposed to evict.
+
+            * UIProcess/WebProcessProxy.cpp:
+            (WebKit::WebProcessProxy::canTerminateChildProcess):
+            This is a speculative fix for the crash which aligns the branch with trunk. There is
+            a period of time where a SuspendedPageProxy can exist for a given process but the
+            WebProcessPool is no longer aware of it. This is when we're about to use the
+            SuspendedPageProxy for a load. If WebProcessProxy::maybeShutDown() gets called during
+            this period of time, canTerminateChildProcess() would incorrectly return true and we
+            would cache the WebProcess even though it is about to do a load. The new code relies
+            on m_suspendedPageCount which is a lot more reliable than asking the process pool.
+
+2019-05-30  Kocsen Chung  <[email protected]>
+
         Apply patch. rdar://problem/50857668
 
     2019-05-30  Chris Dumez  <[email protected]>

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessCache.cpp (245930 => 245931)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessCache.cpp	2019-05-31 00:30:28 UTC (rev 245930)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessCache.cpp	2019-05-31 00:30:30 UTC (rev 245931)
@@ -191,11 +191,25 @@
     RELEASE_LOG(ProcessSwapping, "%p - WebProcessCache::evictProcess(): Evicting process %i from WebProcess cache because it expired", this, process.processIdentifier());
 
     std::unique_ptr<CachedProcess> cachedProcess;
-    auto it = m_processesPerRegistrableDomain.find(process.registrableDomain());
-    if (it != m_processesPerRegistrableDomain.end() && &it->value->process() == &process) {
-        cachedProcess = WTFMove(it->value);
-        m_processesPerRegistrableDomain.remove(it);
+    auto registrableDomain = process.registrableDomain();
+    ASSERT(!registrableDomain.isEmpty());
+    if (registrableDomain.isEmpty()) {
+        for (auto it = m_processesPerRegistrableDomain.begin(); it != m_processesPerRegistrableDomain.end(); ++it) {
+            if (&it->value->process() == &process) {
+                cachedProcess = WTFMove(it->value);
+                m_processesPerRegistrableDomain.remove(it);
+                break;
+            }
+        }
     } else {
+        auto it = m_processesPerRegistrableDomain.find(registrableDomain);
+        if (it != m_processesPerRegistrableDomain.end() && &it->value->process() == &process) {
+            cachedProcess = WTFMove(it->value);
+            m_processesPerRegistrableDomain.remove(it);
+        }
+    }
+
+    if (!cachedProcess) {
         for (auto& pair : m_pendingAddRequests) {
             if (&pair.value->process() == &process) {
                 cachedProcess = WTFMove(pair.value);
@@ -204,6 +218,7 @@
             }
         }
     }
+
     ASSERT(cachedProcess);
     if (!cachedProcess)
         return;

Modified: branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp (245930 => 245931)


--- branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2019-05-31 00:30:28 UTC (rev 245930)
+++ branches/safari-607-branch/Source/WebKit/UIProcess/WebProcessProxy.cpp	2019-05-31 00:30:30 UTC (rev 245931)
@@ -1003,7 +1003,7 @@
 
 bool WebProcessProxy::canTerminateChildProcess()
 {
-    if (!m_pageMap.isEmpty() || m_processPool->hasSuspendedPageFor(*this) || !m_provisionalPages.isEmpty() || m_isInProcessCache)
+    if (!m_pageMap.isEmpty() || m_suspendedPageCount || !m_provisionalPages.isEmpty() || m_isInProcessCache)
         return false;
 
     if (!m_processPool->shouldTerminate(this))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to