<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK][Threaded Compositor] ASSERTION FAILED: !!handle ^ !!m_nativeSurfaceHandle with several layout tests"
   href="https://bugs.webkit.org/show_bug.cgi?id=160143">160143</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[GTK][Threaded Compositor] ASSERTION FAILED: !!handle ^ !!m_nativeSurfaceHandle with several layout tests
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Local Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Keywords</th>
          <td>Gtk
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>WebKit Gtk
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cgarcia&#64;igalia.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>bugs-noreply&#64;webkitgtk.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>154066
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is tricky. We have a message to set the native surface handle and another one for destroying it, the former is a normal message while the latter is sync. This assertion happens if the web view is realized before the web process is launched. This is the sequence:

1.- DrawingAreaProxyImpl sends SetNativeSurfaceHandleForCompositing message to the web process, since the process hasn't been launched yet, the message is queued.
2.- Web process is launched and queued messages and now sent to the web process
3.- The page is closed right after the web process is launched, and DrawingAreaProxyImpl sends DestroyNativeSurfaceHandleForCompositing to the web process
4.- The web process processes incoming messages, and DestroyNativeSurfaceHandleForCompositing is processed first because it's sync
5.- The web process processes SetNativeSurfaceHandleForCompositing message

This is not only producing the assertion, it's also setting a handle for a X window already destroyed in the UI process, so this could be producing the X errors we hace seen in other tests. So, we need to make sure SetNativeSurfaceHandleForCompositing and DestroyNativeSurfaceHandleForCompositing are handled in order by the web process. We could make SetNativeSurfaceHandleForCompositing sync as well, but sync messages are just ignored when sent before the web process has been launched (only normal messages are queued for obvious reasons). The other option is to sending the SetNativeSurfaceHandleForCompositing message with the IPC::DispatchMessageEvenWhenWaitingForSyncReply flag. In this case the message is queued and dispatched on process launch, but it's dispatched before other messages also queued but without that flag set, like CreateWebPage. Since there's no WebPage there's the web process doesn't find a valid message receiver for it and it's discarded. We need to ensure there Dra

STDERR: ASSERTION FAILED: !!handle ^ !!m_nativeSurfaceHandle
STDERR: ../../Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp(75) : WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t)::&lt;lambda()&gt;
STDERR: 1   0x7f5b958c2aef /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTFCrash+0x1e) [0x7f5b958c2aef]
STDERR: 2   0x7f5b9c3a1f72 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x583ff72) [0x7f5b9c3a1f72]
STDERR: 3   0x7f5b9c3a8a02 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5846a02) [0x7f5b9c3a8a02]
STDERR: 4   0x7f5b9bd96fed /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WTF::Function&lt;void ()&gt;::operator()() const+0x37) [0x7f5b9bd96fed]
STDERR: 5   0x7f5b9c3a0613 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x583e613) [0x7f5b9c3a0613]
STDERR: 6   0x7f5b9c3a100a /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x583f00a) [0x7f5b9c3a100a]
STDERR: 7   0x7f5b9bd96fed /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WTF::Function&lt;void ()&gt;::operator()() const+0x37) [0x7f5b9bd96fed]
STDERR: 8   0x7f5b958de3ba /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTF::RunLoop::performWork()+0xce) [0x7f5b958de3ba]
STDERR: 9   0x7f5b959211f4 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x22641f4) [0x7f5b959211f4]
STDERR: 10  0x7f5b95921219 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x2264219) [0x7f5b95921219]
STDERR: 11  0x7f5b95921194 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x2264194) [0x7f5b95921194]
STDERR: 12  0x7f5b959211c3 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x22641c3) [0x7f5b959211c3]
STDERR: 13  0x7f5b913a2a26 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/DependenciesGTK/Root/lib/libglib-2.0.so.0(+0x53a26) [0x7f5b913a2a26]
STDERR: 14  0x7f5b913a3854 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/DependenciesGTK/Root/lib/libglib-2.0.so.0(g_main_context_dispatch+0x33) [0x7f5b913a3854]
STDERR: 15  0x7f5b913a3a39 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/DependenciesGTK/Root/lib/libglib-2.0.so.0(+0x54a39) [0x7f5b913a3a39]
STDERR: 16  0x7f5b913a3e60 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/DependenciesGTK/Root/lib/libglib-2.0.so.0(g_main_loop_run+0x1d7) [0x7f5b913a3e60]
STDERR: 17  0x7f5b95921794 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(WTF::RunLoop::run()+0xac) [0x7f5b95921794]
STDERR: 18  0x7f5b9c3a08b7 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::CompositingRunLoop::run()+0x11) [0x7f5b9c3a08b7]
STDERR: 19  0x7f5b9c3a33f0 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(WebKit::ThreadedCompositor::runCompositingThread()+0x128) [0x7f5b9c3a33f0]
STDERR: 20  0x7f5b9c3a31dd /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x58411dd) [0x7f5b9c3a31dd]
STDERR: 21  0x7f5b9c3a5b09 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(+0x5843b09) [0x7f5b9c3a5b09]
STDERR: 22  0x7f5b9bddb782 /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libwebkit2gtk-4.0.so.37(std::function&lt;void ()&gt;::operator()() const+0x32) [0x7f5b9bddb782]
STDERR: 23  0x7f5b958dfbec /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x2222bec) [0x7f5b958dfbec]
STDERR: 24  0x7f5b9591b28d /home/slave/webkitgtk/gtk-linux-64-debug/build/WebKitBuild/Debug/lib/libjavascriptcoregtk-4.0.so.18(+0x225e28d) [0x7f5b9591b28d]
STDERR: 25  0x7f5b92fc80a4 /lib/x86_64-linux-gnu/libpthread.so.0(+0x80a4) [0x7f5b92fc80a4]
STDERR: 26  0x7f5b8e2d087d /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7f5b8e2d087d]</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>