<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Use GTestDBus instead of dbus-launch in WebKitTestBus.cpp"
   href="https://bugs.webkit.org/show_bug.cgi?id=161481#c10">Comment # 10</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [GTK] Use GTestDBus instead of dbus-launch in WebKitTestBus.cpp"
   href="https://bugs.webkit.org/show_bug.cgi?id=161481">bug 161481</a>
              from <span class="vcard"><a class="email" href="mailto:cgarcia&#64;igalia.com" title="Carlos Garcia Campos &lt;cgarcia&#64;igalia.com&gt;"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=161481#c8">comment #8</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=293416&amp;action=diff" name="attach_293416" title="Patch">attachment 293416</a> <a href="attachment.cgi?id=293416&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; The problem is that if you do that, the test will randomly crash; we don't
&gt; need more flaky tests.</span >

Why? Could you show a bt of one of such crashes? Because our current code is calling setenv in the same place, this patch is only replacing the code that GTestDBus with GTestDBus.

<span class="quote">&gt; In fact, since g_test_dbus_up() calls setenv()
&gt; itself, it suffers from the same problem.</span >

Exactly, it's not a problem of this patch, but an existing problem (if any) and I have never seen random crashes in the tests using WebKitTestBus.

<span class="quote">&gt; We need to be careful to only call
&gt; such functions (a) at the very top of main(),</span >

Which is exactly what happens. This is not public API, this is an internal helper class designed to be used by tests that should do this at the very beginning of beforeAll():

bus = new WebKitTestBus();
if (!bus-&gt;run())
    return;

And beforeAll() is called by main() right after setting up the environment and registering gresources. There isn't any other code before that, nor any other secondary thread created.

<span class="quote">&gt; or (b) when we're really
&gt; really sure that it's before the first secondary thread has been created,
&gt; otherwise the test will be flaky. And it's impossible for WebKitTestBus to
&gt; guarantee where it's used from, so it really needs to not be setting
&gt; environment variables.</span >

We are already ensuring both a) and b), and we don't need WebKitTestBus to ensure anything, we just need to use it as it's designed to be used, at the very beginning of beforeAll(). Another option would be to do it unconditionally in main() for all tests, but that could slow down the tests that don't need dbus at all.

<span class="quote">&gt; Is it even possible to create a GObject without starting secondary threads?</span >

There isn't any thread nor GObject created in this case when WebKitTestBus::run is called.</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>