Changeset 246606 in webkit


Ignore:
Timestamp:
Jun 19, 2019 12:44:10 PM (5 years ago)
Author:
sihui_liu@apple.com
Message:

Crash at com.apple.WebKit: WebKit::WebsiteDataStore::processPools const
https://bugs.webkit.org/show_bug.cgi?id=198935
<rdar://problem/51549308>

Reviewed by Geoffrey Garen.

When WebProcessProxy is in WebProcessCache or is pre-warmed, it does not hold a strong reference of
WebProcessPool. In this case, we should not store the raw pointer of WebProcessPool and perform websiteDataStore
operations with it.
This patch should fix the crash at dereferencing null pointer of WebProcessPool in
WebsiteDataStore::processPools, but it is unclear why websiteDataStore comes to observe cached or prewarmed web
process that should not have web page. The release log may help us find the cause.

  • UIProcess/WebProcessProxy.cpp:

(WebKit::WebProcessProxy::processPoolIfExists const):

  • UIProcess/WebProcessProxy.h:
  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::processPools const):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r246605 r246606  
     12019-06-19  Sihui Liu  <sihui_liu@apple.com>
     2
     3        Crash at com.apple.WebKit: WebKit::WebsiteDataStore::processPools const
     4        https://bugs.webkit.org/show_bug.cgi?id=198935
     5        <rdar://problem/51549308>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        When WebProcessProxy is in WebProcessCache or is pre-warmed, it does not hold a strong reference of
     10        WebProcessPool. In this case, we should not store the raw pointer of WebProcessPool and perform websiteDataStore
     11        operations with it.
     12        This patch should fix the crash at dereferencing null pointer of WebProcessPool in
     13        WebsiteDataStore::processPools, but it is unclear why websiteDataStore comes to observe cached or prewarmed web
     14        process that should not have web page. The release log may help us find the cause.
     15
     16        * UIProcess/WebProcessProxy.cpp:
     17        (WebKit::WebProcessProxy::processPoolIfExists const):
     18        * UIProcess/WebProcessProxy.h:
     19        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     20        (WebKit::WebsiteDataStore::processPools const):
     21
    1222019-06-19  Alex Christensen  <achristensen@webkit.org>
    223
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp

    r246452 r246606  
    15171517}
    15181518
     1519WebProcessPool* WebProcessProxy::processPoolIfExists() const
     1520{
     1521    if (m_isPrewarmed || m_isInProcessCache)
     1522        RELEASE_LOG_ERROR(Process, "%p - WebProcessProxy::processPoolIfExists: trying to get WebProcessPool from an inactive WebProcessProxy %i", this, processIdentifier());
     1523    else
     1524        ASSERT(m_processPool);
     1525    return m_processPool.get();
     1526}
     1527
    15191528WebProcessPool& WebProcessProxy::processPool() const
    15201529{
  • trunk/Source/WebKit/UIProcess/WebProcessProxy.h

    r246413 r246606  
    120120    void decrementSuspendedPageCount();
    121121
     122    WebProcessPool* processPoolIfExists() const;
    122123    WebProcessPool& processPool() const;
    123124
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r246530 r246606  
    17181718{
    17191719    HashSet<RefPtr<WebProcessPool>> processPools;
    1720     for (auto& process : processes())
    1721         processPools.add(&process->processPool());
     1720    for (auto& process : processes()) {
     1721        if (auto* processPool = process->processPoolIfExists())
     1722            processPools.add(processPool);
     1723    }
    17221724
    17231725    if (processPools.isEmpty()) {
Note: See TracChangeset for help on using the changeset viewer.