<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="https://git.reviewboard.kde.org/r/118614/">https://git.reviewboard.kde.org/r/118614/</a>
     </td>
    </tr>
   </table>
   <br />





<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On June 8th, 2014, 1:20 p.m. UTC, <b>Thiago Macieira</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">QDBusConnection is supposed to be threadsafe.</pre>
 </blockquote>




 <p>On June 8th, 2014, 1:22 p.m. UTC, <b>David Faure</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">It's definitely not... https://bugreports.qt-project.org/browse/QTBUG-39528</pre>
 </blockquote>








</blockquote>

<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Thiago, can we agree on using KDBusConnectionPool for now, until the races described in QTBUG-39528 are fixed?
It's easy to switch later, once QDBusConnection::sessionBus isn't racy anymore. I'd like multithreaded usage of KIO to be stable even with the current Qt versions.</pre>
<br />










<p>- David</p>


<br />
<p>On June 8th, 2014, 10:11 a.m. UTC, David Faure wrote:</p>








<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://git.reviewboard.kde.org/static/rb/images/review_request_box_top_bg.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for KDE Frameworks, Aleix Pol Gonzalez and Thiago Macieira.</div>
<div>By David Faure.</div>


<p style="color: grey;"><i>Updated June 8, 2014, 10:11 a.m.</i></p>









<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt;">Repository: </b>
kio
</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Unittest for kiocore's thread-safety


KIO thread safety: use one DBus connection per thread


KIO thread safety: don't use static buffers.

They obviously lead to data races between threads.

KIO: create one instance of Scheduler per thread.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">helgrind'ing the unittest.

I found and fixed many races within Qt by doing that...
Race on QMutex::id --> https://codereview.qt-project.org/86237
Race in QThreadStorage --> https://codereview.qt-project.org/87047
Race in QLoggingCategory --> https://codereview.qt-project.org/87054

Also reported QTBUG-39528 (QDBusConnection::sessionBus race)  (but we have KDBusConnectionPool for that)

And there are still more races in Qt: 
QMutex::isRecursive, qdbus_loadLibDBus, QDBusConnectionPrivate::connectSignal, qt_message_print....

And a few in our code:
the getenv(KDE_FORK_SLAVES) in KIO, and the dbus interface for klauncher in KDEInitInterface::ensureKdeinitRunning.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>src/core/scheduler.cpp <span style="color: grey">(e762e369b8d74971831dc1e9f4d083bfd77b8e30)</span></li>

 <li>src/core/connectionbackend.cpp <span style="color: grey">(532141af5ab7676d1287379e56ff48bd7fa10c37)</span></li>

 <li>autotests/threadtest.cpp <span style="color: grey">(PRE-CREATION)</span></li>

 <li>autotests/CMakeLists.txt <span style="color: grey">(81d261b8620e0a0512a5bc021ed189e910c0922a)</span></li>

</ul>

<p><a href="https://git.reviewboard.kde.org/r/118614/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>