Changeset 231298 in webkit


Ignore:
Timestamp:
May 3, 2018 1:45:32 AM (6 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
https://bugs.webkit.org/show_bug.cgi?id=183348

Reviewed by Michael Catanzaro.

Source/WebKit:

When connection doesn't exit in case of sync message failure, always exit in case of failing to send
GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
and destroyed quickly.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::ensureNetworkProcessConnection):
(WebKit::WebProcess::ensureWebToStorageProcessConnection):

Tools:

Add a test case to reproduce the crash.

  • TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:

(testWebViewCloseQuickly):
(beforeAll):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r231295 r231298  
     12018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
     4        https://bugs.webkit.org/show_bug.cgi?id=183348
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        When connection doesn't exit in case of sync message failure, always exit in case of failing to send
     9        GetNetworkProcessConnection or GetStorageProcessConnection messages. This can happen when the WebView is created
     10        and destroyed quickly.
     11
     12        * WebProcess/WebProcess.cpp:
     13        (WebKit::WebProcess::ensureNetworkProcessConnection):
     14        (WebKit::WebProcess::ensureWebToStorageProcessConnection):
     15
    1162018-05-02  Nan Wang  <n_wang@apple.com>
    217
  • trunk/Source/WebKit/WebProcess/WebProcess.cpp

    r230711 r231298  
    11491149        IPC::Attachment encodedConnectionIdentifier;
    11501150
    1151         if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetNetworkProcessConnection(), Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0, Seconds::infinity(), IPC::SendSyncOption::DoNotProcessIncomingMessagesWhenWaitingForSyncReply))
     1151        if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetNetworkProcessConnection(), Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0, Seconds::infinity(), IPC::SendSyncOption::DoNotProcessIncomingMessagesWhenWaitingForSyncReply)) {
     1152#if PLATFORM(GTK) || PLATFORM(WPE)
     1153            // GTK+ and WPE ports don't exit on send sync message failure.
     1154            // In this particular case, the network process can be terminated by the UI process while the
     1155            // Web process is still initializing, so we always want to exit instead of crashing. This can
     1156            // happen when the WebView is created and then destroyed quickly.
     1157            // See https://bugs.webkit.org/show_bug.cgi?id=183348.
     1158            exit(0);
     1159#else
    11521160            CRASH();
     1161#endif
     1162        }
    11531163
    11541164#if USE(UNIX_DOMAIN_SOCKETS)
     
    12231233        IPC::Attachment encodedConnectionIdentifier;
    12241234
    1225         if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetStorageProcessConnection(initialSessionID), Messages::WebProcessProxy::GetStorageProcessConnection::Reply(encodedConnectionIdentifier), 0))
     1235        if (!parentProcessConnection()->sendSync(Messages::WebProcessProxy::GetStorageProcessConnection(initialSessionID), Messages::WebProcessProxy::GetStorageProcessConnection::Reply(encodedConnectionIdentifier), 0)) {
     1236#if PLATFORM(GTK) || PLATFORM(WPE)
     1237            // GTK+ and WPE ports don't exit on send sync message failure.
     1238            // In this particular case, the storage process can be terminated by the UI process while the
     1239            // connection is being done, so we always want to exit instead of crashing.
     1240            // See https://bugs.webkit.org/show_bug.cgi?id=183348.
     1241#else
    12261242            CRASH();
     1243#endif
     1244        }
    12271245
    12281246#if USE(UNIX_DOMAIN_SOCKETS)
  • trunk/Tools/ChangeLog

    r231276 r231298  
     12018-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r222772): [GTK][WPE] WebProcess from WebKitGtk+ 2.19.9x SIGSEVs in WebKit::WebProcess::ensureNetworkProcessConnection() at Source/WebKit/WebProcess/WebProcess.cpp:1127
     4        https://bugs.webkit.org/show_bug.cgi?id=183348
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Add a test case to reproduce the crash.
     9
     10        * TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp:
     11        (testWebViewCloseQuickly):
     12        (beforeAll):
     13
    1142018-05-02  Aditya Keerthi  <akeerthi@apple.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitWebView.cpp

    r231042 r231298  
    106106}
    107107
     108static void testWebViewCloseQuickly(WebViewTest* test, gconstpointer)
     109{
     110    auto webView = Test::adoptView(Test::createWebView());
     111    test->assertObjectIsDeletedWhenTestFinishes(G_OBJECT(webView.get()));
     112    g_idle_add([](gpointer userData) -> gboolean {
     113        static_cast<WebViewTest*>(userData)->quitMainLoop();
     114        return G_SOURCE_REMOVE;
     115    }, test);
     116    g_main_loop_run(test->m_mainLoop);
     117    webView = nullptr;
     118}
     119
    108120#if PLATFORM(WPE)
    109121static void testWebViewWebBackend(Test* test, gconstpointer)
     
    12041216    WebViewTest::add("WebKitWebView", "web-context", testWebViewWebContext);
    12051217    WebViewTest::add("WebKitWebView", "web-context-lifetime", testWebViewWebContextLifetime);
     1218    WebViewTest::add("WebKitWebView", "close-quickly", testWebViewCloseQuickly);
    12061219#if PLATFORM(WPE)
    12071220    Test::add("WebKitWebView", "backend", testWebViewWebBackend);
Note: See TracChangeset for help on using the changeset viewer.