Changeset 248047 in webkit


Ignore:
Timestamp:
Jul 31, 2019 10:37:51 AM (5 years ago)
Author:
Chris Dumez
Message:

REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
https://bugs.webkit.org/show_bug.cgi?id=200086
<rdar://problem/53501721>

Reviewed by Alex Christensen.

Source/WebKit:

The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
test was flaky because it expected the network process to receive the IPC from the UIProcess
*before* the one from the WebContent process. However, there is no guarantee about ordering
from IPC messages coming from different connections.

To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
process processes this IPC *before* receiving any IPC from the WebContent process that is
the result of IPC from the UIProcess.

  • NetworkProcess/NetworkProcess.cpp:

(WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):

  • NetworkProcess/NetworkProcess.h:
  • NetworkProcess/NetworkProcess.messages.in:
  • UIProcess/API/Cocoa/WKProcessPool.mm:

(-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):

  • UIProcess/Network/NetworkProcessProxy.cpp:

(WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):

  • UIProcess/Network/NetworkProcessProxy.h:
  • UIProcess/WebProcessPool.cpp:

(WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
(WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.

  • UIProcess/WebProcessPool.h:

Tools:

re-enable the API test.

  • TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:

(TEST):

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r248039 r248047  
     12019-07-31  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
     4        https://bugs.webkit.org/show_bug.cgi?id=200086
     5        <rdar://problem/53501721>
     6
     7        Reviewed by Alex Christensen.
     8
     9        The test would first send a ProcessWillSuspendImminently IPC to the NetworkProcess and then
     10        run JS in the WebContent process, which would in turn send IPC to the NetworkProcess. The
     11        test was flaky because it expected the network process to receive the IPC from the UIProcess
     12        *before* the one from the WebContent process. However, there is no guarantee about ordering
     13        from IPC messages coming from different connections.
     14
     15        To address the flakiness, this patch introduces a new ProcessWillSuspendImminentlyForTesting
     16        synchronous IPC and uses this instead. As a result, it is now guaranteed that the network
     17        process processes this IPC *before* receiving any IPC from the WebContent process that is
     18        the result of IPC from the UIProcess.
     19
     20        * NetworkProcess/NetworkProcess.cpp:
     21        (WebKit::NetworkProcess::processWillSuspendImminentlyForTestingSync):
     22        * NetworkProcess/NetworkProcess.h:
     23        * NetworkProcess/NetworkProcess.messages.in:
     24        * UIProcess/API/Cocoa/WKProcessPool.mm:
     25        (-[WKProcessPool _sendNetworkProcessWillSuspendImminently]):
     26        * UIProcess/Network/NetworkProcessProxy.cpp:
     27        (WebKit::NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting):
     28        * UIProcess/Network/NetworkProcessProxy.h:
     29        * UIProcess/WebProcessPool.cpp:
     30        (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting):
     31        (WebKit::WebProcessPool::sendNetworkProcessWillSuspendImminently): Deleted.
     32        * UIProcess/WebProcessPool.h:
     33
    1342019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    235
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r248010 r248047  
    21112111}
    21122112
     2113void NetworkProcess::processWillSuspendImminentlyForTestingSync(CompletionHandler<void()>&& completionHandler)
     2114{
     2115    processWillSuspendImminently();
     2116    completionHandler();
     2117}
     2118
    21132119void NetworkProcess::prepareToSuspend()
    21142120{
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r248010 r248047  
    182182
    183183    void processWillSuspendImminently();
     184    void processWillSuspendImminentlyForTestingSync(CompletionHandler<void()>&&);
    184185    void prepareToSuspend();
    185186    void cancelPrepareToSuspend();
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in

    r247270 r248047  
    8080
    8181    ProcessWillSuspendImminently()
     82    ProcessWillSuspendImminentlyForTestingSync() -> () Synchronous
    8283    PrepareToSuspend()
    8384    CancelPrepareToSuspend()
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPool.mm

    r247759 r248047  
    440440- (void)_sendNetworkProcessWillSuspendImminently
    441441{
    442     _processPool->sendNetworkProcessWillSuspendImminently();
     442    _processPool->sendNetworkProcessWillSuspendImminentlyForTesting();
    443443}
    444444
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp

    r247868 r248047  
    982982        send(Messages::NetworkProcess::ProcessWillSuspendImminently(), 0);
    983983}
     984
     985void NetworkProcessProxy::sendProcessWillSuspendImminentlyForTesting()
     986{
     987    if (canSendMessage())
     988        sendSync(Messages::NetworkProcess::ProcessWillSuspendImminentlyForTestingSync(), Messages::NetworkProcess::ProcessWillSuspendImminentlyForTestingSync::Reply(), 0);
     989}
    984990   
    985991void NetworkProcessProxy::sendPrepareToSuspend()
  • trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h

    r247822 r248047  
    186186    void sendProcessWillSuspendImminently() final;
    187187    void sendProcessDidResume() final;
     188   
     189    void sendProcessWillSuspendImminentlyForTesting();
    188190
    189191private:
  • trunk/Source/WebKit/UIProcess/WebProcessPool.cpp

    r247933 r248047  
    17771777}
    17781778
    1779 void WebProcessPool::sendNetworkProcessWillSuspendImminently()
     1779void WebProcessPool::sendNetworkProcessWillSuspendImminentlyForTesting()
    17801780{
    17811781    if (m_networkProcess)
    1782         m_networkProcess->sendProcessWillSuspendImminently();
     1782        m_networkProcess->sendProcessWillSuspendImminentlyForTesting();
    17831783}
    17841784
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r247759 r248047  
    313313    void clearPermanentCredentialsForProtectionSpace(WebCore::ProtectionSpace&&, CompletionHandler<void()>&&);
    314314    void terminateNetworkProcess();
    315     void sendNetworkProcessWillSuspendImminently();
     315    void sendNetworkProcessWillSuspendImminentlyForTesting();
    316316    void sendNetworkProcessDidResume();
    317317    void terminateServiceWorkerProcesses();
  • trunk/Tools/ChangeLog

    r248039 r248047  
     12019-07-31  Chris Dumez  <cdumez@apple.com>
     2
     3        REGRESSION (r247486?): Flaky API Test TestWebKitAPI.WKWebView.LocalStorageProcessSuspends
     4        https://bugs.webkit.org/show_bug.cgi?id=200086
     5        <rdar://problem/53501721>
     6
     7        Reviewed by Alex Christensen.
     8
     9        re-enable the API test.
     10
     11        * TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm:
     12        (TEST):
     13
    1142019-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/LocalStoragePersistence.mm

    r247929 r248047  
    113113}
    114114
    115 TEST(WKWebView, DISABLED_LocalStorageProcessSuspends)
     115TEST(WKWebView, LocalStorageProcessSuspends)
    116116{
    117117    readyToContinue = false;
Note: See TracChangeset for help on using the changeset viewer.